--- a/examples/csma-broadcast.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/csma-broadcast.cc Tue Mar 11 13:30:12 2008 -0700
@@ -149,7 +149,7 @@
// 512 bytes (default) at a rate of 500 Kb/s (default) from n0
NS_LOG_INFO ("Create Applications.");
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("255.255.255.255", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -162,7 +162,7 @@
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
@@ -172,7 +172,7 @@
sink->Stop (Seconds (10.0));
// Create an optional packet sink to receive these packets
- sink = CreateObjectWith<PacketSink> (
+ sink = CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
--- a/examples/csma-multicast.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/csma-multicast.cc Tue Mar 11 13:30:12 2008 -0700
@@ -278,7 +278,7 @@
// Configure a multicast packet generator that generates a packet
// every few seconds
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress (multicastGroup, port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -297,7 +297,7 @@
// If you enable logging on this (above) it will print a log statement
// for every packet received
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n4,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
--- a/examples/csma-one-subnet.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/csma-one-subnet.cc Tue Mar 11 13:30:12 2008 -0700
@@ -160,7 +160,7 @@
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.1.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -176,7 +176,7 @@
//
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
//
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.1.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
--- a/examples/csma-packet-socket.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/csma-packet-socket.cc Tue Mar 11 13:30:12 2008 -0700
@@ -62,9 +62,9 @@
static Ptr<CsmaNetDevice>
CreateCsmaDevice (Ptr<Node> node, Ptr<CsmaChannel> channel)
{
- Ptr<CsmaNetDevice> device = CreateObjectWith<CsmaNetDevice> ("Node", node,
- "Address", Mac48Address::Allocate (),
- "EncapsulationMode", String ("Llc"));
+ Ptr<CsmaNetDevice> device = CreateObject<CsmaNetDevice> ("Node", node,
+ "Address", Mac48Address::Allocate (),
+ "EncapsulationMode", String ("Llc"));
node->AddDevice (device);
device->Attach (channel);
Ptr<Queue> queue = CreateObject<DropTailQueue> ();
@@ -114,7 +114,8 @@
// create the shared medium used by all csma devices.
NS_LOG_INFO ("Create channels.");
- Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> (DataRate(5000000), MilliSeconds(2));
+ Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> ("BitRate", DataRate(5000000),
+ "Delay", MilliSeconds(2));
// use a helper function to connect our nodes to the shared channel.
NS_LOG_INFO ("Build Topology.");
@@ -140,7 +141,7 @@
// from n0 to n1
NS_LOG_INFO ("Create Applications.");
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (n0ToN1),
"Protocol", TypeId::LookupByName ("Packet"),
@@ -152,7 +153,7 @@
ooff->Stop (Seconds(10.0));
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (n3ToN0),
"Protocol", TypeId::LookupByName ("Packet"),
--- a/examples/mixed-global-routing.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/mixed-global-routing.cc Tue Mar 11 13:30:12 2008 -0700
@@ -186,7 +186,7 @@
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
--- a/examples/simple-alternate-routing.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/simple-alternate-routing.cc Tue Mar 11 13:30:12 2008 -0700
@@ -183,7 +183,7 @@
// Create a flow from n3 to n1, starting at time 1.1 seconds
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.1.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -196,7 +196,7 @@
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n1,
"Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
--- a/examples/simple-error-model.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/simple-error-model.cc Tue Mar 11 13:30:12 2008 -0700
@@ -143,7 +143,7 @@
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -155,7 +155,7 @@
ooff->Stop (Seconds(10.0));
// Create an optional packet sink to receive these packets
- Ptr<PacketSink> sink = CreateObjectWith<PacketSink> (
+ Ptr<PacketSink> sink = CreateObject<PacketSink> (
"Node", n3,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
@@ -165,7 +165,7 @@
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -177,7 +177,7 @@
ooff->Stop (Seconds(10.0));
// Create a packet sink to receive these packets
- sink = CreateObjectWith<PacketSink> (
+ sink = CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
@@ -205,7 +205,7 @@
(n3, channel2);
// Create an ErrorModel based on the implementation (constructor)
// specified by the default classId
- Ptr<RateErrorModel> em = CreateObjectWith<RateErrorModel> ("RanVar", UniformVariable (0.0, 1.0),
+ Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ("RanVar", UniformVariable (0.0, 1.0),
"Rate", Double (0.001));
nd3->AddReceiveErrorModel (em);
--- a/examples/simple-global-routing.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/simple-global-routing.cc Tue Mar 11 13:30:12 2008 -0700
@@ -160,7 +160,7 @@
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> ("Node", n0,
+ CreateObject<OnOffApplication> ("Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
"OnTime", ConstantVariable (1),
@@ -173,7 +173,7 @@
// Create a packet sink to receive these packets
// The last argument "true" disables output from the Receive callback
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> ("Node", n3,
+ CreateObject<PacketSink> ("Node", n3,
"Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n3->AddApplication (sink);
@@ -182,7 +182,7 @@
sink->Stop (Seconds (10.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -194,7 +194,7 @@
ooff->Stop (Seconds (10.0));
// Create a packet sink to receive these packets
- sink = CreateObjectWith<PacketSink> ("Node", n1,
+ sink = CreateObject<PacketSink> ("Node", n1,
"Remote", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
n1->AddApplication (sink);
--- a/examples/simple-point-to-point-olsr.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/simple-point-to-point-olsr.cc Tue Mar 11 13:30:12 2008 -0700
@@ -167,7 +167,7 @@
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.4.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -179,7 +179,7 @@
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n4,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
@@ -188,7 +188,7 @@
sink->Start (Seconds (1.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n4,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -199,7 +199,7 @@
ooff->Start (Seconds(1.1));
// Create a packet sink to receive these packets
- sink = CreateObjectWith<PacketSink> (
+ sink = CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
--- a/examples/simple-point-to-point.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/simple-point-to-point.cc Tue Mar 11 13:30:12 2008 -0700
@@ -136,7 +136,7 @@
NS_LOG_INFO ("Create Applications.");
uint16_t port = 9; // Discard port (RFC 863)
Ptr<OnOffApplication> ooff =
- CreateObjectWith<OnOffApplication> (
+ CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -148,7 +148,7 @@
// Create an optional packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n3,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
@@ -157,7 +157,7 @@
sink->Start (Seconds (1.0));
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n3,
"Remote", Address (InetSocketAddress ("10.1.2.1", port)),
"Protocol", TypeId::LookupByName ("Udp"),
@@ -168,7 +168,7 @@
ooff->Start(Seconds(1.1));
// Create a packet sink to receive these packets
- sink = CreateObjectWith<PacketSink> (
+ sink = CreateObject<PacketSink> (
"Node", n1,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), port)),
"Protocol", TypeId::LookupByName ("Udp"));
@@ -180,7 +180,7 @@
// Create a file transfer from n0 to n3, starting at time 1.2
uint16_t servPort = 500;
- ooff = CreateObjectWith<OnOffApplication> (
+ ooff = CreateObject<OnOffApplication> (
"Node", n0,
"Remote", Address (InetSocketAddress ("10.1.3.2", servPort)),
"Protocol", TypeId::LookupByName ("Tcp"),
@@ -192,7 +192,7 @@
ooff->Stop (Seconds(1.35));
// Create a packet sink to receive these TCP packets
- sink = CreateObjectWith<PacketSink> (
+ sink = CreateObject<PacketSink> (
"Node", n3,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
--- a/examples/tcp-large-transfer-errors.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/tcp-large-transfer-errors.cc Tue Mar 11 13:30:12 2008 -0700
@@ -198,7 +198,7 @@
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
--- a/examples/tcp-large-transfer.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/tcp-large-transfer.cc Tue Mar 11 13:30:12 2008 -0700
@@ -198,7 +198,7 @@
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
--- a/examples/tcp-small-transfer-oneloss.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/tcp-small-transfer-oneloss.cc Tue Mar 11 13:30:12 2008 -0700
@@ -180,7 +180,7 @@
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
--- a/examples/tcp-small-transfer.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/tcp-small-transfer.cc Tue Mar 11 13:30:12 2008 -0700
@@ -190,7 +190,7 @@
// Create a packet sink to receive these packets
Ptr<PacketSink> sink =
- CreateObjectWith<PacketSink> (
+ CreateObject<PacketSink> (
"Node", n2,
"Local", Address (InetSocketAddress (Ipv4Address::GetAny (), servPort)),
"Protocol", TypeId::LookupByName ("Tcp"));
--- a/examples/udp-echo.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/examples/udp-echo.cc Tue Mar 11 13:30:12 2008 -0700
@@ -161,7 +161,7 @@
//
uint16_t port = 9; // well-known echo port number
- Ptr<UdpEchoServer> server = CreateObjectWith<UdpEchoServer> ("Node", n1,
+ Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
//
@@ -173,7 +173,7 @@
Time interPacketInterval = Seconds (1.);
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (maxPacketCount),
--- a/samples/main-adhoc-wifi.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/samples/main-adhoc-wifi.cc Tue Mar 11 13:30:12 2008 -0700
@@ -136,7 +136,7 @@
NetDeviceContainer devices = wifi.Build (c);
MobilityHelper mobility;
- Ptr<ListPositionAllocator> positionAlloc = CreateObjectWith<ListPositionAllocator> ();
+ Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (5.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
@@ -149,7 +149,7 @@
destination.SetSingleDevice (0);
destination.SetPhysicalAddress (devices.Get (1)->GetAddress ());
Ptr<Application> app =
- CreateObjectWith<OnOffApplication> ("Node", c.Get (0),
+ CreateObject<OnOffApplication> ("Node", c.Get (0),
"Remote", Address (destination),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable (250),
--- a/samples/main-ap-wifi.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/samples/main-ap-wifi.cc Tue Mar 11 13:30:12 2008 -0700
@@ -144,7 +144,7 @@
destination.SetSingleDevice (0);
destination.SetPhysicalAddress (staDevs.Get(1)->GetAddress ());
Ptr<Application> app =
- CreateObjectWith<OnOffApplication> ("Node", stas.Get (0),
+ CreateObject<OnOffApplication> ("Node", stas.Get (0),
"Remote", Address (destination),
"Protocol", TypeId::LookupByName ("Packet"),
"OnTime", ConstantVariable (42),
--- a/samples/main-propagation-loss.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/samples/main-propagation-loss.cc Tue Mar 11 13:30:12 2008 -0700
@@ -29,8 +29,8 @@
{
Ptr<StaticMobilityModel> a = CreateObject<StaticMobilityModel> ();
Ptr<StaticMobilityModel> b = CreateObject<StaticMobilityModel> ();
- Ptr<LogDistancePropagationLossModel> log = CreateObjectWith<LogDistancePropagationLossModel> ();
- log->SetReferenceModel (CreateObjectWith<FriisPropagationLossModel> ());
+ Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
+ log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ());
Ptr<PropagationLossModel> model = log;
--- a/src/core/attribute-test.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/core/attribute-test.cc Tue Mar 11 13:30:12 2008 -0700
@@ -272,11 +272,11 @@
CHECK_GET_STR (p, "TestBoolName", "false");
CHECK_GET_PARAM (p, "TestBoolName", Boolean, false);
- p = CreateObjectWith<AttributeObjectTest> ("TestBoolName", String ("true"));
+ p = CreateObject<AttributeObjectTest> ("TestBoolName", String ("true"));
CHECK_GET_STR (p, "TestBoolName", "true");
CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
- p = CreateObjectWith<AttributeObjectTest> ("TestBoolName", Boolean (true));
+ p = CreateObject<AttributeObjectTest> ("TestBoolName", Boolean (true));
CHECK_GET_STR (p, "TestBoolName", "true");
CHECK_GET_PARAM (p, "TestBoolName", Boolean, true);
@@ -300,7 +300,7 @@
Ptr<AttributeObjectTest> x = p->GetAttribute ("TestPtr");
NS_TEST_ASSERT (x == 0);
- p = CreateObjectWith<AttributeObjectTest> ("TestPtr", Create<Derived> ());
+ p = CreateObject<AttributeObjectTest> ("TestPtr", Create<Derived> ());
NS_TEST_ASSERT (p != 0);
derived = 0;
derived = p->GetAttribute ("TestPtr");
@@ -428,12 +428,12 @@
}
NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("AttributeObjectTest::TestBoolName", String ("true")));
- p = CreateObjectWith<AttributeObjectTest> ();
+ p = CreateObject<AttributeObjectTest> ();
Boolean boolV = p->GetAttribute ("TestBoolName");
NS_TEST_ASSERT_EQUAL (boolV, Boolean (true));
NS_TEST_ASSERT (AttributeList::GetGlobal ()->SetFailSafe ("AttributeObjectTest::TestBoolName", String ("false")));
- p = CreateObjectWith<AttributeObjectTest> ();
+ p = CreateObject<AttributeObjectTest> ();
boolV = p->GetAttribute ("TestBoolName");
NS_TEST_ASSERT_EQUAL (boolV, Boolean (false));
--- a/src/core/object.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/core/object.h Tue Mar 11 13:30:12 2008 -0700
@@ -507,24 +507,6 @@
template <typename T>
friend Ptr<T> CreateObject (const AttributeList &attributes);
- template <typename T>
- friend Ptr<T> CreateObject (void);
- template <typename T, typename T1>
- friend Ptr<T> CreateObject (T1 a1);
- template <typename T, typename T1, typename T2>
- friend Ptr<T> CreateObject (T1 a1, T2 a2);
- template <typename T, typename T1, typename T2, typename T3>
- friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3);
- template <typename T, typename T1, typename T2, typename T3, typename T4>
- friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4);
- template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
- friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
- template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
- friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
- template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
- friend Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
-
-
bool DoSet (Ptr<const AttributeAccessor> spec, Attribute intialValue,
Ptr<const AttributeChecker> checker, Attribute value);
Ptr<Object> DoGetObject (TypeId tid) const;
@@ -671,84 +653,17 @@
}
template <typename T>
-Ptr<T> CreateObject (void)
-{
- Ptr<T> p = Ptr<T> (new T (), false);
- p->SetTypeId (T::GetTypeId ());
- p->Object::Construct (AttributeList ());
- return p;
-}
-
-template <typename T, typename T1>
-Ptr<T> CreateObject (T1 a1)
-{
- Ptr<T> p = Ptr<T> (new T (a1), false);
- p->SetTypeId (T::GetTypeId ());
- p->Object::Construct (AttributeList ());
- return p;
-}
-
-template <typename T, typename T1, typename T2>
-Ptr<T> CreateObject (T1 a1, T2 a2)
-{
- Ptr<T> p = Ptr<T> (new T (a1, a2), false);
- p->SetTypeId (T::GetTypeId ());
- p->Object::Construct (AttributeList ());
- return p;
-}
-template <typename T, typename T1, typename T2, typename T3>
-Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3)
-{
- Ptr<T> p = Ptr<T> (new T (a1, a2, a3), false);
- p->SetTypeId (T::GetTypeId ());
- return p;
-}
-
-template <typename T, typename T1, typename T2, typename T3, typename T4>
-Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
-{
- Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4), false);
- p->SetTypeId (T::GetTypeId ());
- return p;
-}
-
-template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
-Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
-{
- Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5), false);
- p->SetTypeId (T::GetTypeId ());
- return p;
-}
-
-template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
-{
- Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false);
- p->SetTypeId (T::GetTypeId ());
- return p;
-}
-
-template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
-Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
-{
- Ptr<T> p = Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false);
- p->SetTypeId (T::GetTypeId ());
- return p;
-}
-
-
-template <typename T>
Ptr<T>
-CreateObjectWith (std::string n1 = "", Attribute v1 = Attribute (),
- std::string n2 = "", Attribute v2 = Attribute (),
- std::string n3 = "", Attribute v3 = Attribute (),
- std::string n4 = "", Attribute v4 = Attribute (),
- std::string n5 = "", Attribute v5 = Attribute (),
- std::string n6 = "", Attribute v6 = Attribute (),
- std::string n7 = "", Attribute v7 = Attribute (),
- std::string n8 = "", Attribute v8 = Attribute (),
- std::string n9 = "", Attribute v9 = Attribute ())
-
+CreateObject (std::string n1 = "", Attribute v1 = Attribute (),
+ std::string n2 = "", Attribute v2 = Attribute (),
+ std::string n3 = "", Attribute v3 = Attribute (),
+ std::string n4 = "", Attribute v4 = Attribute (),
+ std::string n5 = "", Attribute v5 = Attribute (),
+ std::string n6 = "", Attribute v6 = Attribute (),
+ std::string n7 = "", Attribute v7 = Attribute (),
+ std::string n8 = "", Attribute v8 = Attribute (),
+ std::string n9 = "", Attribute v9 = Attribute ())
+
{
AttributeList attributes;
if (n1 == "")
--- a/src/devices/csma/csma-channel.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/csma/csma-channel.cc Tue Mar 11 13:30:12 2008 -0700
@@ -45,48 +45,32 @@
return active;
}
+TypeId
+CsmaChannel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("CsmaChannel")
+ .SetParent<Channel> ()
+ .AddConstructor<CsmaChannel> ()
+ .AddAttribute ("BitRate", "The maximum bitrate of the channel",
+ DataRate (0xffffffff),
+ MakeDataRateAccessor (&CsmaChannel::m_bps),
+ MakeDataRateChecker ())
+ .AddAttribute ("Delay", "Transmission delay through the channel",
+ Seconds (0),
+ MakeTimeAccessor (&CsmaChannel::m_delay),
+ MakeTimeChecker ())
+ ;
+ return tid;
+}
//
// By default, you get a channel with the name "Csma Channel" that
// has an "infitely" fast transmission speed and zero delay.
CsmaChannel::CsmaChannel()
:
- Channel ("Csma Channel"),
- m_bps (DataRate(0xffffffff)),
- m_delay (Seconds(0))
-{
- NS_LOG_FUNCTION;
- Init();
-}
-
-CsmaChannel::CsmaChannel(
- const DataRate& bps,
- const Time& delay)
-:
- Channel ("Csma Channel"),
- m_bps (bps),
- m_delay (delay)
+ Channel ("Csma Channel")
{
NS_LOG_FUNCTION;
- NS_LOG_PARAMS (this << Channel::GetName() << bps.GetBitRate() << delay);
- Init();
-}
-
-CsmaChannel::CsmaChannel(
- const std::string& name,
- const DataRate& bps,
- const Time& delay)
-:
- Channel (name),
- m_bps (bps),
- m_delay (delay)
-{
- NS_LOG_FUNCTION;
- NS_LOG_PARAMS (this << name << bps.GetBitRate() << delay);
- Init();
-}
-
-void CsmaChannel::Init() {
m_state = IDLE;
m_deviceList.clear();
}
--- a/src/devices/csma/csma-channel.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/csma/csma-channel.h Tue Mar 11 13:30:12 2008 -0700
@@ -85,8 +85,10 @@
* packet to the channel is really connected to this channel
*
*/
-class CsmaChannel : public Channel {
+class CsmaChannel : public Channel
+{
public:
+ static TypeId GetTypeId (void);
/**
* \brief Create a CsmaChannel
*
@@ -94,24 +96,6 @@
* has an "infitely" fast transmission speed and zero delay.
*/
CsmaChannel ();
-
- /**
- * \brief Create a CsmaChannel
- *
- * \param bps The bitrate of the channel
- * \param delay Transmission delay through the channel
- */
- CsmaChannel (const DataRate& bps, const Time& delay);
-
- /**
- * \brief Create a CsmaChannel
- *
- * \param name the name of the channel for identification purposes
- * \param bps The bitrate of the channel
- * \param delay Transmission delay through the channel
- */
- CsmaChannel (const std::string& name,
- const DataRate& bps, const Time& delay);
/**
* \brief Attach a given netdevice to this channel
@@ -298,11 +282,6 @@
* Current state of the channel
*/
WireState m_state;
- /**
- * Initializes the channel when it is constructed. Resets the
- * deviceList and sets the channel state to IDLE.
- */
- void Init (void);
};
} // namespace ns3
--- a/src/devices/csma/csma-ipv4-topology.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/csma/csma-ipv4-topology.cc Tue Mar 11 13:30:12 2008 -0700
@@ -41,10 +41,10 @@
Ptr<CsmaChannel> channel,
Mac48Address addr)
{
- Ptr<Queue> q = CreateObjectWith<DropTailQueue> ();
+ Ptr<Queue> q = CreateObject<DropTailQueue> ();
// assume full-duplex
- Ptr<CsmaNetDevice> nd = CreateObjectWith<CsmaNetDevice> ("Node", node,
+ Ptr<CsmaNetDevice> nd = CreateObject<CsmaNetDevice> ("Node", node,
"Address", addr,
"EncapsulationMode", String ("IpArp"));
node->AddDevice (nd);
@@ -60,9 +60,9 @@
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
- Ptr<Queue> q = CreateObjectWith<DropTailQueue> ();
+ Ptr<Queue> q = CreateObject<DropTailQueue> ();
- Ptr<CsmaNetDevice> nd0 = CreateObjectWith<CsmaNetDevice> ("Node", n1,
+ Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Llc"));
n1->AddDevice (nd0);
@@ -71,7 +71,7 @@
nd0->AddQueue(q);
nd0->Attach (ch);
- Ptr<CsmaNetDevice> nd1 = CreateObjectWith<CsmaNetDevice> ("Node", n1,
+ Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Llc"));
n1->AddDevice (nd1);
@@ -86,9 +86,9 @@
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
- Ptr<Queue> q = CreateObjectWith<DropTailQueue> ();
+ Ptr<Queue> q = CreateObject<DropTailQueue> ();
- Ptr<CsmaNetDevice> nd0 = CreateObjectWith<CsmaNetDevice> ("Node", n1,
+ Ptr<CsmaNetDevice> nd0 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Raw"));
n1->AddDevice (nd0);
@@ -97,7 +97,7 @@
nd0->AddQueue(q);
nd0->Attach (ch);
- Ptr<CsmaNetDevice> nd1 = CreateObjectWith<CsmaNetDevice> ("Node", n1,
+ Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Node", n1,
"Address", addr,
"EncapsulationMode", String ("Raw"));
n1->AddDevice (nd1);
--- a/src/devices/csma/csma-topology.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/csma/csma-topology.cc Tue Mar 11 13:30:12 2008 -0700
@@ -36,7 +36,7 @@
const DataRate& bps,
const Time& delay)
{
- Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> (bps, delay);
+ Ptr<CsmaChannel> channel = CreateObject<CsmaChannel> ("BitRate", bps, "Delay", delay);
return channel;
}
@@ -48,7 +48,7 @@
Ptr<CsmaChannel> ch,
Mac48Address addr)
{
- Ptr<CsmaNetDevice> nd1 = CreateObjectWith<CsmaNetDevice> ("Node", Ptr<Node> (n1),
+ Ptr<CsmaNetDevice> nd1 = CreateObject<CsmaNetDevice> ("Node", Ptr<Node> (n1),
"Address", addr,
"EncapsulationMode", "EthernetV1");
--- a/src/devices/point-to-point/point-to-point-channel.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/point-to-point/point-to-point-channel.cc Tue Mar 11 13:30:12 2008 -0700
@@ -29,46 +29,35 @@
namespace ns3 {
+TypeId
+PointToPointChannel::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("PointToPointChannel")
+ .SetParent<Channel> ()
+ .AddConstructor<PointToPointChannel> ()
+ .AddAttribute ("BitRate", "The maximum bitrate of the channel",
+ DataRate (0xffffffff),
+ MakeDataRateAccessor (&PointToPointChannel::m_bps),
+ MakeDataRateChecker ())
+ .AddAttribute ("Delay", "Transmission delay through the channel",
+ Seconds (0),
+ MakeTimeAccessor (&PointToPointChannel::m_delay),
+ MakeTimeChecker ())
+ ;
+ return tid;
+}
+
//
// By default, you get a channel with the name "PointToPoint Channel" that
// has an "infitely" fast transmission speed and zero delay.
PointToPointChannel::PointToPointChannel()
:
Channel ("PointToPoint Channel"),
- m_bps (DataRate(0xffffffff)),
- m_delay (Seconds(0)),
m_nDevices(0)
{
NS_LOG_FUNCTION;
}
-PointToPointChannel::PointToPointChannel(
- const DataRate& bps,
- const Time& delay)
-:
- Channel ("PointToPoint Channel"),
- m_bps (bps),
- m_delay (delay),
- m_nDevices(0)
-{
- NS_LOG_FUNCTION;
- NS_LOG_PARAMS (this << Channel::GetName() << bps.GetBitRate() << delay);
-}
-
-PointToPointChannel::PointToPointChannel(
- const std::string& name,
- const DataRate& bps,
- const Time& delay)
-:
- Channel (name),
- m_bps (bps),
- m_delay (delay),
- m_nDevices(0)
-{
- NS_LOG_FUNCTION;
- NS_LOG_PARAMS (this << name << bps.GetBitRate() << delay);
-}
-
void
PointToPointChannel::Attach(Ptr<PointToPointNetDevice> device)
{
--- a/src/devices/point-to-point/point-to-point-channel.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/point-to-point/point-to-point-channel.h Tue Mar 11 13:30:12 2008 -0700
@@ -49,8 +49,11 @@
* [0] wire to transmit on. The second device gets the [1] wire. There is a
* state (IDLE, TRANSMITTING) associated with each wire.
*/
-class PointToPointChannel : public Channel {
+class PointToPointChannel : public Channel
+{
public:
+ static TypeId GetTypeId (void);
+
/**
* \brief Create a PointToPointChannel
*
@@ -58,24 +61,6 @@
* has an "infitely" fast transmission speed and zero delay.
*/
PointToPointChannel ();
-
- /**
- * \brief Create a PointToPointChannel
- *
- * \param bps The maximum bitrate of the channel
- * \param delay Transmission delay through the channel
- */
- PointToPointChannel (const DataRate& bps, const Time& delay);
-
- /**
- * \brief Create a PointToPointChannel
- *
- * \param name the name of the channel for identification purposes
- * \param bps The maximum bitrate of the channel
- * \param delay Transmission delay through the channel
- */
- PointToPointChannel (const std::string& name,
- const DataRate& bps, const Time& delay);
/**
* \brief Attach a given netdevice to this channel
--- a/src/devices/point-to-point/point-to-point-topology.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/point-to-point/point-to-point-topology.cc Tue Mar 11 13:30:12 2008 -0700
@@ -46,21 +46,21 @@
const DataRate& bps,
const Time& delay)
{
- Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> (bps, delay);
+ Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> ("BitRate", bps, "Delay", delay);
- Ptr<PointToPointNetDevice> net1 = CreateObjectWith<PointToPointNetDevice> ("Node", n1,
- "Address", Mac48Address::Allocate ());
+ Ptr<PointToPointNetDevice> net1 = CreateObject<PointToPointNetDevice> ("Node", n1,
+ "Address", Mac48Address::Allocate ());
n1->AddDevice (net1);
- Ptr<Queue> q = CreateObjectWith<DropTailQueue> ();
+ Ptr<Queue> q = CreateObject<DropTailQueue> ();
net1->AddQueue(q);
net1->Attach (channel);
- Ptr<PointToPointNetDevice> net2 = CreateObjectWith<PointToPointNetDevice> ("Node", n2,
- "Address", Mac48Address::Allocate ());
+ Ptr<PointToPointNetDevice> net2 = CreateObject<PointToPointNetDevice> ("Node", n2,
+ "Address", Mac48Address::Allocate ());
n2->AddDevice (net2);
- q = CreateObjectWith<DropTailQueue> ();
+ q = CreateObject<DropTailQueue> ();
net2->AddQueue(q);
net2->Attach (channel);
--- a/src/devices/wifi/adhoc-wifi-mac.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/wifi/adhoc-wifi-mac.cc Tue Mar 11 13:30:12 2008 -0700
@@ -48,7 +48,7 @@
m_rxMiddle = new MacRxMiddle ();
m_rxMiddle->SetForwardCallback (MakeCallback (&AdhocWifiMac::ForwardUp, this));
- m_low = CreateObjectWith<MacLow> ();
+ m_low = CreateObject<MacLow> ();
m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
m_low->SetMac (this);
--- a/src/devices/wifi/dca-txop.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/wifi/dca-txop.cc Tue Mar 11 13:30:12 2008 -0700
@@ -132,7 +132,7 @@
{
m_transmissionListener = new DcaTxop::TransmissionListener (this);
m_dcf = new DcaTxop::Dcf (this);
- m_queue = CreateObjectWith<WifiMacQueue> ();
+ m_queue = CreateObject<WifiMacQueue> ();
m_rng = new RealRandomStream ();
m_txMiddle = new MacTxMiddle ();
}
--- a/src/devices/wifi/propagation-loss-model.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/wifi/propagation-loss-model.cc Tue Mar 11 13:30:12 2008 -0700
@@ -252,10 +252,10 @@
* rx = rx0(tx) - 10 * n * log (d/d0)
*/
static Ptr<StaticMobilityModel> zero =
- CreateObjectWith<StaticMobilityModel> ("position",
+ CreateObject<StaticMobilityModel> ("position",
Vector (0.0, 0.0, 0.0));
static Ptr<StaticMobilityModel> reference =
- CreateObjectWith<StaticMobilityModel> ("position",
+ CreateObject<StaticMobilityModel> ("position",
Vector (m_referenceDistance, 0.0, 0.0));
double rx0 = m_reference->GetRxPower (txPowerDbm, zero, reference);
double pathLossDb = 10 * m_exponent * log10 (distance / m_referenceDistance);
--- a/src/devices/wifi/wifi-helper.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/devices/wifi/wifi-helper.cc Tue Mar 11 13:30:12 2008 -0700
@@ -92,10 +92,10 @@
NetDeviceContainer
WifiHelper::Build (NodeContainer c) const
{
- Ptr<WifiChannel> channel = CreateObjectWith<WifiChannel> ();
- channel->SetPropagationDelayModel (CreateObjectWith<ConstantSpeedPropagationDelayModel> ());
- Ptr<LogDistancePropagationLossModel> log = CreateObjectWith<LogDistancePropagationLossModel> ();
- log->SetReferenceModel (CreateObjectWith<FriisPropagationLossModel> ());
+ Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
+ channel->SetPropagationDelayModel (CreateObject<ConstantSpeedPropagationDelayModel> ());
+ Ptr<LogDistancePropagationLossModel> log = CreateObject<LogDistancePropagationLossModel> ();
+ log->SetReferenceModel (CreateObject<FriisPropagationLossModel> ());
channel->SetPropagationLossModel (log);
return Build (c, channel);
}
--- a/src/internet-node/arp-ipv4-interface.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/arp-ipv4-interface.cc Tue Mar 11 13:30:12 2008 -0700
@@ -34,9 +34,7 @@
namespace ns3 {
-ArpIpv4Interface::ArpIpv4Interface (Ptr<Node> node, Ptr<NetDevice> device)
- : Ipv4Interface (device),
- m_node (node)
+ArpIpv4Interface::ArpIpv4Interface ()
{
NS_LOG_FUNCTION;
}
@@ -47,6 +45,30 @@
}
void
+ArpIpv4Interface::DoDispose (void)
+{
+ m_node = 0;
+ m_device = 0;
+}
+
+void
+ArpIpv4Interface::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+void
+ArpIpv4Interface::SetDevice (Ptr<NetDevice> device)
+{
+ m_device = device;
+}
+
+Ptr<NetDevice>
+ArpIpv4Interface::GetDevice (void) const
+{
+ return m_device;
+}
+
+void
ArpIpv4Interface::SendTo (Ptr<Packet> p, Ipv4Address dest)
{
NS_LOG_FUNCTION;
--- a/src/internet-node/arp-ipv4-interface.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/arp-ipv4-interface.h Tue Mar 11 13:30:12 2008 -0700
@@ -39,12 +39,19 @@
class ArpIpv4Interface : public Ipv4Interface
{
public:
- ArpIpv4Interface (Ptr<Node> node, Ptr<NetDevice> device);
+ ArpIpv4Interface ();
virtual ~ArpIpv4Interface ();
+ void SetNode (Ptr<Node> node);
+ void SetDevice (Ptr<NetDevice> device);
+
+ virtual Ptr<NetDevice> GetDevice (void) const;
+
private:
virtual void SendTo (Ptr<Packet> p, Ipv4Address dest);
+ virtual void DoDispose (void);
Ptr<Node> m_node;
+ Ptr<NetDevice> m_device;
};
}//namespace ns3
--- a/src/internet-node/arp-l3-protocol.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/arp-l3-protocol.cc Tue Mar 11 13:30:12 2008 -0700
@@ -42,11 +42,6 @@
{
static TypeId tid = TypeId ("ArpL3Protocol")
.SetParent<Object> ()
- .AddAttribute ("Node", "The node to which this protocol is associated.",
- TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
- Ptr<Node> (0),
- MakePtrAccessor (&ArpL3Protocol::m_node),
- MakePtrChecker<Node> ())
;
return tid;
}
@@ -62,6 +57,12 @@
}
void
+ArpL3Protocol::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
+void
ArpL3Protocol::DoDispose (void)
{
NS_LOG_FUNCTION;
--- a/src/internet-node/arp-l3-protocol.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/arp-l3-protocol.h Tue Mar 11 13:30:12 2008 -0700
@@ -47,6 +47,9 @@
*/
ArpL3Protocol ();
virtual ~ArpL3Protocol ();
+
+ void SetNode (Ptr<Node> node);
+
/**
* \brief Recieve a packet
*/
--- a/src/internet-node/internet-node.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/internet-node.cc Tue Mar 11 13:30:12 2008 -0700
@@ -52,8 +52,10 @@
void
InternetNode::Construct (void)
{
- Ptr<Ipv4L3Protocol> ipv4 = CreateObjectWith<Ipv4L3Protocol> ("Node", Ptr<Node> (this));
- Ptr<ArpL3Protocol> arp = CreateObjectWith<ArpL3Protocol> ("Node", Ptr<Node> (this));
+ Ptr<Ipv4L3Protocol> ipv4 = CreateObject<Ipv4L3Protocol> ();
+ Ptr<ArpL3Protocol> arp = CreateObject<ArpL3Protocol> ();
+ ipv4->SetNode (this);
+ arp->SetNode (this);
// XXX remove the PeekPointer below.
RegisterProtocolHandler (MakeCallback (&Ipv4L3Protocol::Receive, PeekPointer (ipv4)),
Ipv4L3Protocol::PROT_NUMBER, 0);
@@ -61,16 +63,24 @@
ArpL3Protocol::PROT_NUMBER, 0);
- Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObjectWith<Ipv4L4Demux> ("Node", Ptr<Node> (this));
- Ptr<UdpL4Protocol> udp = CreateObjectWith<UdpL4Protocol> ("Node", Ptr<Node> (this));
- Ptr<TcpL4Protocol> tcp = CreateObjectWith<TcpL4Protocol> ("Node", Ptr<Node> (this));
+ Ptr<Ipv4L4Demux> ipv4L4Demux = CreateObject<Ipv4L4Demux> ();
+ Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
+ Ptr<TcpL4Protocol> tcp = CreateObject<TcpL4Protocol> ();
+
+ ipv4L4Demux->SetNode (this);
+ udp->SetNode (this);
+ tcp->SetNode (this);
ipv4L4Demux->Insert (udp);
ipv4L4Demux->Insert (tcp);
- Ptr<UdpImpl> udpImpl = CreateObject<UdpImpl> (udp);
- Ptr<TcpImpl> tcpImpl = CreateObject<TcpImpl> (tcp);
- Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> (ipv4);
+ Ptr<UdpImpl> udpImpl = CreateObject<UdpImpl> ();
+ Ptr<TcpImpl> tcpImpl = CreateObject<TcpImpl> ();
+ Ptr<Ipv4Impl> ipv4Impl = CreateObject<Ipv4Impl> ();
+
+ udpImpl->SetUdp (udp);
+ tcpImpl->SetTcp (tcp);
+ ipv4Impl->SetIpv4 (ipv4);
Object::AggregateObject (ipv4);
Object::AggregateObject (arp);
--- a/src/internet-node/ipv4-impl.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-impl.cc Tue Mar 11 13:30:12 2008 -0700
@@ -26,14 +26,19 @@
namespace ns3 {
-Ipv4Impl::Ipv4Impl (Ptr<Ipv4L3Protocol> ipv4)
- : m_ipv4 (ipv4)
+Ipv4Impl::Ipv4Impl ()
+ : m_ipv4 (0)
{}
Ipv4Impl::~Ipv4Impl ()
{
NS_ASSERT (m_ipv4 == 0);
}
void
+Ipv4Impl::SetIpv4 (Ptr<Ipv4L3Protocol> ipv4)
+{
+ m_ipv4 = ipv4;
+}
+void
Ipv4Impl::DoDispose (void)
{
m_ipv4 = 0;
--- a/src/internet-node/ipv4-impl.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-impl.h Tue Mar 11 13:30:12 2008 -0700
@@ -31,10 +31,12 @@
class Ipv4Impl : public Ipv4
{
public:
- Ipv4Impl (Ptr<Ipv4L3Protocol> ipv4);
+ Ipv4Impl ();
virtual ~Ipv4Impl ();
+ void SetIpv4 (Ptr<Ipv4L3Protocol> ipv4);
+
virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol,
int16_t priority);
--- a/src/internet-node/ipv4-interface.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-interface.cc Tue Mar 11 13:30:12 2008 -0700
@@ -35,13 +35,12 @@
* becoming useable, the user must invoke SetUp on them
* once the final Ipv4 address and mask has been set.
*/
-Ipv4Interface::Ipv4Interface (Ptr<NetDevice> nd)
- : m_netdevice (nd),
- m_ifup(false),
+Ipv4Interface::Ipv4Interface ()
+ : m_ifup(false),
m_metric(1)
{
NS_LOG_FUNCTION;
- NS_LOG_PARAMS (this << &nd);
+ NS_LOG_PARAMS (this);
}
Ipv4Interface::~Ipv4Interface ()
@@ -53,17 +52,9 @@
Ipv4Interface::DoDispose (void)
{
NS_LOG_FUNCTION;
- m_netdevice = 0;
Object::DoDispose ();
}
-Ptr<NetDevice>
-Ipv4Interface::GetDevice (void) const
-{
- NS_LOG_FUNCTION;
- return m_netdevice;
-}
-
void
Ipv4Interface::SetAddress (Ipv4Address a)
{
@@ -123,12 +114,12 @@
Ipv4Interface::GetMtu (void) const
{
NS_LOG_FUNCTION;
- if (m_netdevice == 0)
+ if (GetDevice () == 0)
{
uint32_t mtu = (1<<16) - 1;
return mtu;
}
- return m_netdevice->GetMtu ();
+ return GetDevice ()->GetMtu ();
}
/**
--- a/src/internet-node/ipv4-interface.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-interface.h Tue Mar 11 13:30:12 2008 -0700
@@ -69,14 +69,14 @@
* This value can be zero in which case the MTU
* of this interface will be 2^(16-1).
*/
- Ipv4Interface (Ptr<NetDevice> nd);
+ Ipv4Interface ();
virtual ~Ipv4Interface();
/**
* \returns the underlying NetDevice. This method can return
* zero if this interface has no associated NetDevice.
*/
- Ptr<NetDevice> GetDevice (void) const;
+ virtual Ptr<NetDevice> GetDevice (void) const = 0;
/**
* \param a set the ipv4 address of this interface.
@@ -150,7 +150,6 @@
virtual void DoDispose (void);
private:
virtual void SendTo (Ptr<Packet> p, Ipv4Address dest) = 0;
- Ptr<NetDevice> m_netdevice;
bool m_ifup;
Ipv4Address m_address;
Ipv4Mask m_netmask;
--- a/src/internet-node/ipv4-l3-protocol.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-l3-protocol.cc Tue Mar 11 13:30:12 2008 -0700
@@ -56,11 +56,6 @@
Uinteger (64),
MakeUintegerAccessor (&Ipv4L3Protocol::m_defaultTtl),
MakeUintegerChecker<uint8_t> ())
- .AddAttribute ("Node", "The node to which this l3 protocol is attached.",
- TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
- Ptr<Node> (0),
- MakePtrAccessor (&Ipv4L3Protocol::m_node),
- MakePtrChecker<Node> ())
.AddTraceSource ("Tx", "Send ipv4 packet to outgoing interface.",
MakeTraceSourceAccessor (&Ipv4L3Protocol::m_txTrace))
.AddTraceSource ("Rx", "Receive ipv4 packet from incoming interface.",
@@ -82,7 +77,6 @@
NS_LOG_FUNCTION;
m_staticRouting = CreateObject<Ipv4StaticRouting> ();
AddRoutingProtocol (m_staticRouting, 0);
- SetupLoopback ();
}
Ipv4L3Protocol::~Ipv4L3Protocol ()
@@ -90,6 +84,13 @@
NS_LOG_FUNCTION;
}
+void
+Ipv4L3Protocol::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+ SetupLoopback ();
+}
+
void
Ipv4L3Protocol::DoDispose (void)
{
@@ -106,7 +107,8 @@
{
NS_LOG_FUNCTION;
- Ptr<Ipv4LoopbackInterface> interface = CreateObject<Ipv4LoopbackInterface> (m_node);
+ Ptr<Ipv4LoopbackInterface> interface = CreateObject<Ipv4LoopbackInterface> ();
+ interface->SetNode (m_node);
interface->SetAddress (Ipv4Address::GetLoopback ());
interface->SetNetworkMask (Ipv4Mask::GetLoopback ());
uint32_t index = AddIpv4Interface (interface);
@@ -328,7 +330,9 @@
{
NS_LOG_FUNCTION;
NS_LOG_PARAMS (this << &device);
- Ptr<Ipv4Interface> interface = CreateObject<ArpIpv4Interface> (m_node, device);
+ Ptr<ArpIpv4Interface> interface = CreateObject<ArpIpv4Interface> ();
+ interface->SetNode (m_node);
+ interface->SetDevice (device);
return AddIpv4Interface (interface);
}
--- a/src/internet-node/ipv4-l3-protocol.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-l3-protocol.h Tue Mar 11 13:30:12 2008 -0700
@@ -51,6 +51,8 @@
Ipv4L3Protocol();
virtual ~Ipv4L3Protocol ();
+ void SetNode (Ptr<Node> node);
+
/**
* \param ttl default ttl to use
*
--- a/src/internet-node/ipv4-l4-demux.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-l4-demux.cc Tue Mar 11 13:30:12 2008 -0700
@@ -37,10 +37,6 @@
{
static TypeId tid = TypeId ("Ipv4L4Demux")
.SetParent<Object> ()
- .AddAttribute ("Node", "The node to which this object is associated.",
- Ptr<Node> (0),
- MakePtrAccessor (&Ipv4L4Demux::m_node),
- MakePtrChecker<Node> ())
.AddAttribute ("Protocols", "The set of protocols registered with this demux.",
ObjectVector (),
MakeObjectVectorAccessor (&Ipv4L4Demux::m_protocols),
@@ -55,6 +51,12 @@
Ipv4L4Demux::~Ipv4L4Demux()
{}
+void
+Ipv4L4Demux::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
void
Ipv4L4Demux::DoDispose (void)
{
--- a/src/internet-node/ipv4-l4-demux.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-l4-demux.h Tue Mar 11 13:30:12 2008 -0700
@@ -45,6 +45,8 @@
Ipv4L4Demux ();
virtual ~Ipv4L4Demux();
+ void SetNode (Ptr<Node> node);
+
/**
* \param protocol a template for the protocol to add to this L4 Demux.
* \returns the L4Protocol effectively added.
--- a/src/internet-node/ipv4-loopback-interface.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-loopback-interface.cc Tue Mar 11 13:30:12 2008 -0700
@@ -32,9 +32,8 @@
namespace ns3 {
-Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr<Node> node)
- : Ipv4Interface (0),
- m_node (node)
+Ipv4LoopbackInterface::Ipv4LoopbackInterface ()
+ : m_node (0)
{
NS_LOG_FUNCTION;
}
@@ -42,6 +41,19 @@
Ipv4LoopbackInterface::~Ipv4LoopbackInterface ()
{
NS_LOG_FUNCTION;
+ NS_ASSERT (m_node != 0);
+}
+
+Ptr<NetDevice>
+Ipv4LoopbackInterface::GetDevice (void) const
+{
+ return 0;
+}
+
+void
+Ipv4LoopbackInterface::SetNode (Ptr<Node> node)
+{
+ m_node = node;
}
void
--- a/src/internet-node/ipv4-loopback-interface.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/ipv4-loopback-interface.h Tue Mar 11 13:30:12 2008 -0700
@@ -34,13 +34,13 @@
class Ipv4LoopbackInterface : public Ipv4Interface
{
public:
- /**
- * \brief Constructor
- * \param node Pointer to a node associated with this IPv4 interface
- */
- Ipv4LoopbackInterface (Ptr<Node> node);
+ Ipv4LoopbackInterface ();
virtual ~Ipv4LoopbackInterface ();
+ virtual Ptr<NetDevice> GetDevice (void) const;
+
+ void SetNode (Ptr<Node> node);
+
private:
virtual void SendTo (Ptr<Packet> p, Ipv4Address dest);
--- a/src/internet-node/tcp-impl.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/tcp-impl.cc Tue Mar 11 13:30:12 2008 -0700
@@ -24,14 +24,20 @@
namespace ns3 {
-TcpImpl::TcpImpl (Ptr<TcpL4Protocol> tcp)
- : m_tcp (tcp)
+TcpImpl::TcpImpl ()
+ : m_tcp (0)
{}
TcpImpl::~TcpImpl ()
{
NS_ASSERT (m_tcp == 0);
}
+void
+TcpImpl::SetTcp (Ptr<TcpL4Protocol> tcp)
+{
+ m_tcp = tcp;
+}
+
Ptr<Socket>
TcpImpl::CreateSocket (void)
{
--- a/src/internet-node/tcp-impl.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/tcp-impl.h Tue Mar 11 13:30:12 2008 -0700
@@ -42,9 +42,11 @@
class TcpImpl : public Tcp
{
public:
- TcpImpl (Ptr<TcpL4Protocol> tcp);
+ TcpImpl ();
virtual ~TcpImpl ();
+ void SetTcp (Ptr<TcpL4Protocol> tcp);
+
virtual Ptr<Socket> CreateSocket (void);
protected:
--- a/src/internet-node/tcp-l4-protocol.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/tcp-l4-protocol.cc Tue Mar 11 13:30:12 2008 -0700
@@ -350,6 +350,12 @@
NS_LOG_FUNCTION;
}
+void
+TcpL4Protocol::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
int
TcpL4Protocol::GetProtocolNumber (void) const
{
@@ -379,7 +385,10 @@
{
NS_LOG_FUNCTION;
Ptr<RttEstimator> rtt = m_rttFactory.Create<RttEstimator> ();
- Ptr<Socket> socket = CreateObject<TcpSocket> (m_node, this, rtt);
+ Ptr<TcpSocket> socket = CreateObject<TcpSocket> ();
+ socket->SetNode (m_node);
+ socket->SetTcp (this);
+ socket->SetRtt (rtt);
return socket;
}
--- a/src/internet-node/tcp-l4-protocol.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/tcp-l4-protocol.h Tue Mar 11 13:30:12 2008 -0700
@@ -53,6 +53,8 @@
TcpL4Protocol ();
virtual ~TcpL4Protocol ();
+ void SetNode (Ptr<Node> node);
+
virtual int GetProtocolNumber (void) const;
virtual int GetVersion (void) const;
--- a/src/internet-node/tcp-socket.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/tcp-socket.cc Tue Mar 11 13:30:12 2008 -0700
@@ -40,12 +40,12 @@
namespace ns3 {
- TcpSocket::TcpSocket (Ptr<Node> node, Ptr<TcpL4Protocol> tcp, Ptr<RttEstimator> rtt)
+ TcpSocket::TcpSocket ()
: m_skipRetxResched (false),
m_dupAckCount (0),
m_endPoint (0),
- m_node (node),
- m_tcp (tcp),
+ m_node (0),
+ m_tcp (0),
m_errno (ERROR_NOTERROR),
m_shutdownSend (false),
m_shutdownRecv (false),
@@ -61,22 +61,12 @@
m_lastRxAck (0),
m_nextRxSequence (0),
m_pendingData (0),
- m_rtt (rtt),
+ m_rtt (0),
m_lastMeasuredRtt (Seconds(0.0))
{
NS_LOG_FUNCTION;
- NS_LOG_PARAMS (this<<node<<tcp);
+ NS_LOG_PARAMS (this);
- Ptr<Tcp> t = node->GetObject<Tcp> ();
- m_segmentSize = t->GetDefaultSegSize ();
- m_rxWindowSize = t->GetDefaultAdvWin ();
- m_advertisedWindowSize = t->GetDefaultAdvWin ();
- m_cWnd = t->GetDefaultInitialCwnd () * m_segmentSize;
- m_ssThresh = t->GetDefaultSsThresh ();
- m_initialCWnd = t->GetDefaultInitialCwnd ();
- m_cnTimeout = Seconds (t->GetDefaultConnTimeout ());
- m_cnCount = t->GetDefaultConnCount ();
-
}
TcpSocket::~TcpSocket ()
@@ -103,6 +93,33 @@
m_pendingData = 0;
}
+void
+TcpSocket::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+ Ptr<Tcp> t = node->GetObject<Tcp> ();
+ m_segmentSize = t->GetDefaultSegSize ();
+ m_rxWindowSize = t->GetDefaultAdvWin ();
+ m_advertisedWindowSize = t->GetDefaultAdvWin ();
+ m_cWnd = t->GetDefaultInitialCwnd () * m_segmentSize;
+ m_ssThresh = t->GetDefaultSsThresh ();
+ m_initialCWnd = t->GetDefaultInitialCwnd ();
+ m_cnTimeout = Seconds (t->GetDefaultConnTimeout ());
+ m_cnCount = t->GetDefaultConnCount ();
+}
+
+void
+TcpSocket::SetTcp (Ptr<TcpL4Protocol> tcp)
+{
+ m_tcp = tcp;
+}
+void
+TcpSocket::SetRtt (Ptr<RttEstimator> rtt)
+{
+ m_rtt = rtt;
+}
+
+
enum Socket::SocketErrno
TcpSocket::GetErrno (void) const
{
--- a/src/internet-node/tcp-socket.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/tcp-socket.h Tue Mar 11 13:30:12 2008 -0700
@@ -45,9 +45,13 @@
/**
* Create an unbound tcp socket.
*/
- TcpSocket (Ptr<Node> node, Ptr<TcpL4Protocol> tcp, Ptr<RttEstimator> rtt);
+ TcpSocket ();
virtual ~TcpSocket ();
+ void SetNode (Ptr<Node> node);
+ void SetTcp (Ptr<TcpL4Protocol> tcp);
+ void SetRtt (Ptr<RttEstimator> rtt);
+
virtual enum SocketErrno GetErrno (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (void);
--- a/src/internet-node/udp-impl.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/udp-impl.cc Tue Mar 11 13:30:12 2008 -0700
@@ -25,14 +25,20 @@
namespace ns3 {
-UdpImpl::UdpImpl (Ptr<UdpL4Protocol> udp)
- : m_udp (udp)
+UdpImpl::UdpImpl ()
+ : m_udp (0)
{}
UdpImpl::~UdpImpl ()
{
NS_ASSERT (m_udp == 0);
}
+void
+UdpImpl::SetUdp (Ptr<UdpL4Protocol> udp)
+{
+ m_udp = udp;
+}
+
Ptr<Socket>
UdpImpl::CreateSocket (void)
{
--- a/src/internet-node/udp-impl.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/udp-impl.h Tue Mar 11 13:30:12 2008 -0700
@@ -40,9 +40,11 @@
class UdpImpl : public Udp
{
public:
- UdpImpl (Ptr<UdpL4Protocol> udp);
+ UdpImpl ();
virtual ~UdpImpl ();
+ void SetUdp (Ptr<UdpL4Protocol> udp);
+
/**
* \brief Implements a method to create a UdpImpl-based socket and return
* a base class smart pointer to the socket.
--- a/src/internet-node/udp-l4-protocol.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/udp-l4-protocol.cc Tue Mar 11 13:30:12 2008 -0700
@@ -66,6 +66,12 @@
NS_LOG_FUNCTION;
}
+void
+UdpL4Protocol::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
int
UdpL4Protocol::GetProtocolNumber (void) const
{
@@ -95,7 +101,9 @@
UdpL4Protocol::CreateSocket (void)
{
NS_LOG_FUNCTION;
- Ptr<Socket> socket = CreateObject<UdpSocket> (m_node, this);
+ Ptr<UdpSocket> socket = CreateObject<UdpSocket> ();
+ socket->SetNode (m_node);
+ socket->SetUdp (this);
return socket;
}
--- a/src/internet-node/udp-l4-protocol.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/udp-l4-protocol.h Tue Mar 11 13:30:12 2008 -0700
@@ -49,6 +49,8 @@
UdpL4Protocol ();
virtual ~UdpL4Protocol ();
+ void SetNode (Ptr<Node> node);
+
virtual int GetProtocolNumber (void) const;
virtual int GetVersion (void) const;
--- a/src/internet-node/udp-socket.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/udp-socket.cc Tue Mar 11 13:30:12 2008 -0700
@@ -34,10 +34,10 @@
namespace ns3 {
-UdpSocket::UdpSocket (Ptr<Node> node, Ptr<UdpL4Protocol> udp)
+UdpSocket::UdpSocket ()
: m_endPoint (0),
- m_node (node),
- m_udp (udp),
+ m_node (0),
+ m_udp (0),
m_errno (ERROR_NOTERROR),
m_shutdownSend (false),
m_shutdownRecv (false),
@@ -69,6 +69,18 @@
m_udp = 0;
}
+void
+UdpSocket::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+void
+UdpSocket::SetUdp (Ptr<UdpL4Protocol> udp)
+{
+ m_udp = udp;
+}
+
+
enum Socket::SocketErrno
UdpSocket::GetErrno (void) const
{
@@ -400,7 +412,7 @@
Ptr<Node> rxNode = CreateObject<InternetNode> ();
Ptr<PointToPointNetDevice> rxDev1, rxDev2;
{ // first interface
- rxDev1 = CreateObjectWith<PointToPointNetDevice> ("Node", rxNode, "Address", Mac48Address::Allocate ());
+ rxDev1 = CreateObject<PointToPointNetDevice> ("Node", rxNode, "Address", Mac48Address::Allocate ());
rxNode->AddDevice (rxDev1);
rxDev1->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
@@ -411,7 +423,7 @@
}
{ // second interface
- rxDev2 = CreateObjectWith<PointToPointNetDevice> ("Node", rxNode, "Address", Mac48Address::Allocate ());
+ rxDev2 = CreateObject<PointToPointNetDevice> ("Node", rxNode, "Address", Mac48Address::Allocate ());
rxNode->AddDevice (rxDev2);
rxDev2->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = rxNode->GetObject<Ipv4> ();
@@ -425,7 +437,7 @@
Ptr<Node> txNode = CreateObject<InternetNode> ();
Ptr<PointToPointNetDevice> txDev;
{
- txDev = CreateObjectWith<PointToPointNetDevice> ("Node", txNode, "Address", Mac48Address::Allocate ());
+ txDev = CreateObject<PointToPointNetDevice> ("Node", txNode, "Address", Mac48Address::Allocate ());
txNode->AddDevice (txDev);
txDev->AddQueue(CreateObject<DropTailQueue> ());
Ptr<Ipv4> ipv4 = txNode->GetObject<Ipv4> ();
--- a/src/internet-node/udp-socket.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/internet-node/udp-socket.h Tue Mar 11 13:30:12 2008 -0700
@@ -40,9 +40,12 @@
/**
* Create an unbound udp socket.
*/
- UdpSocket (Ptr<Node> node, Ptr<UdpL4Protocol> udp);
+ UdpSocket ();
virtual ~UdpSocket ();
+ void SetNode (Ptr<Node> node);
+ void SetUdp (Ptr<UdpL4Protocol> udp);
+
virtual enum SocketErrno GetErrno (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (void);
--- a/src/mobility/mobility-helper.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/mobility/mobility-helper.cc Tue Mar 11 13:30:12 2008 -0700
@@ -12,7 +12,7 @@
MobilityHelper::MobilityHelper ()
: m_notifierEnabled (false)
{
- m_position = CreateObjectWith<RandomRectanglePositionAllocator> ("X", ConstantVariable (0.0),
+ m_position = CreateObject<RandomRectanglePositionAllocator> ("X", ConstantVariable (0.0),
"Y", ConstantVariable (0.0));
m_mobility.SetTypeId ("StaticMobilityModel");
}
@@ -125,7 +125,7 @@
// we need to setup a hierarchical mobility model
Ptr<MobilityModel> parent = m_mobilityStack.back ();
Ptr<MobilityModel> hierarchical =
- CreateObjectWith<HierarchicalMobilityModel> ("Child", model,
+ CreateObject<HierarchicalMobilityModel> ("Child", model,
"Parent", parent);
object->AggregateObject (hierarchical);
NS_LOG_DEBUG ("node="<<object<<", mob="<<hierarchical);
--- a/src/node/packet-socket-factory.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/node/packet-socket-factory.cc Tue Mar 11 13:30:12 2008 -0700
@@ -40,7 +40,8 @@
Ptr<Socket> PacketSocketFactory::CreateSocket (void)
{
Ptr<Node> node = GetObject<Node> ();
- Ptr<PacketSocket> socket = CreateObject<PacketSocket> (node);
+ Ptr<PacketSocket> socket = CreateObject<PacketSocket> ();
+ socket->SetNode (node);
return socket;
}
} // namespace ns3
--- a/src/node/packet-socket.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/node/packet-socket.cc Tue Mar 11 13:30:12 2008 -0700
@@ -29,16 +29,9 @@
namespace ns3 {
-PacketSocket::PacketSocket (Ptr<Node> node)
- : m_node (node)
+PacketSocket::PacketSocket ()
{
NS_LOG_FUNCTION;
- Init();
-}
-
-void
-PacketSocket::Init()
-{
NS_LOG_FUNCTION;
m_state = STATE_OPEN;
m_shutdownSend = false;
@@ -46,6 +39,12 @@
m_errno = ERROR_NOTERROR;
}
+void
+PacketSocket::SetNode (Ptr<Node> node)
+{
+ m_node = node;
+}
+
PacketSocket::~PacketSocket ()
{
NS_LOG_FUNCTION;
--- a/src/node/packet-socket.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/node/packet-socket.h Tue Mar 11 13:30:12 2008 -0700
@@ -71,9 +71,11 @@
class PacketSocket : public Socket
{
public:
- PacketSocket (Ptr<Node> node);
+ PacketSocket ();
virtual ~PacketSocket ();
+ void SetNode (Ptr<Node> node);
+
virtual enum SocketErrno GetErrno (void) const;
virtual Ptr<Node> GetNode (void) const;
virtual int Bind (void);
@@ -87,9 +89,6 @@
private:
-
-private:
- void Init (void);
void ForwardUp (Ptr<NetDevice> device, Ptr<Packet> packet,
uint16_t protocol, const Address &from);
int DoBind (const PacketSocketAddress &address);
--- a/src/routing/olsr/olsr-agent-impl.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/src/routing/olsr/olsr-agent-impl.cc Tue Mar 11 13:30:12 2008 -0700
@@ -250,7 +250,9 @@
NS_LOG_DEBUG ("Starting OLSR on node " << m_mainAddress);
- m_routingTable = CreateObject<RoutingTable> (m_ipv4, m_mainAddress);
+ m_routingTable = CreateObject<RoutingTable> ();
+ m_routingTable->SetIpv4 (m_ipv4);
+ m_routingTable->SetMainAddress (m_mainAddress);
// Add OLSR as routing protocol, with slightly higher priority than
// static routing.
m_ipv4->AddRoutingProtocol (m_routingTable, 10);
--- a/src/routing/olsr/routing-table.h Tue Mar 11 11:35:26 2008 -0700
+++ b/src/routing/olsr/routing-table.h Tue Mar 11 13:30:12 2008 -0700
@@ -74,11 +74,9 @@
public:
RoutingTable () {}
- RoutingTable (Ptr<Ipv4> ipv4, const Ipv4Address &mainAddress)
- :
- m_ipv4 (ipv4),
- m_mainAddress (mainAddress)
- {}
+
+ void SetIpv4 (Ptr<Ipv4> ipv4) {m_ipv4 = ipv4;}
+ void SetMainAddress (Ipv4Address mainAddress) {m_mainAddress = mainAddress;}
~RoutingTable () {}
--- a/tutorial/point-to-point-ipv4-topology.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/point-to-point-ipv4-topology.cc Tue Mar 11 13:30:12 2008 -0700
@@ -34,7 +34,7 @@
const DataRate& bps,
const Time& delay)
{
- return CreateObject<PointToPointChannel> (bps, delay);
+ return CreateObject<PointToPointChannel> ("BitRate", bps, "Delay", delay);
}
uint32_t
@@ -45,7 +45,7 @@
NS_ASSERT (channel->GetNDevices () <= 1);
Ptr<PointToPointNetDevice> nd =
- CreateObjectWith<PointToPointNetDevice> ("Node", node,
+ CreateObject<PointToPointNetDevice> ("Node", node,
"Address", Mac48Address::Allocate ());
node->AddDevice (nd);
Ptr<Queue> q = CreateObject<DropTailQueue> ();
--- a/tutorial/tutorial-bus-network.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-bus-network.cc Tue Mar 11 13:30:12 2008 -0700
@@ -44,7 +44,7 @@
Ptr<Node> n0 = bus.GetNode (0);
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.0.1"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -54,7 +54,7 @@
Ptr<Node> n1 = bus.GetNode (1);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1, "Port", Uinteger (port));
+ CreateObject<UdpEchoServer> ("Node", n1, "Port", Uinteger (port));
n1->AddApplication (server);
server->Start(Seconds(1.));
--- a/tutorial/tutorial-csma-echo-ascii-trace.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-csma-echo-ascii-trace.cc Tue Mar 11 13:30:12 2008 -0700
@@ -69,7 +69,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -78,7 +78,7 @@
n0->AddApplication (client);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1,
+ CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
--- a/tutorial/tutorial-csma-echo-pcap-trace.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-csma-echo-pcap-trace.cc Tue Mar 11 13:30:12 2008 -0700
@@ -70,7 +70,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -79,7 +79,7 @@
n0->AddApplication (client);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1,
+ CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
--- a/tutorial/tutorial-csma-echo.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-csma-echo.cc Tue Mar 11 13:30:12 2008 -0700
@@ -68,7 +68,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -77,7 +77,7 @@
n0->AddApplication (client);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1,
+ CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
--- a/tutorial/tutorial-linear-dumbbell.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-linear-dumbbell.cc Tue Mar 11 13:30:12 2008 -0700
@@ -127,7 +127,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client0 =
- CreateObjectWith<UdpEchoClient> (
+ CreateObject<UdpEchoClient> (
"Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.2.1"),
"RemotePort", Uinteger (port),
@@ -136,7 +136,7 @@
"PacketSize", Uinteger (1024));
n0->AddApplication (client0);
Ptr<UdpEchoClient> client1 =
- CreateObjectWith<UdpEchoClient> (
+ CreateObject<UdpEchoClient> (
"Node", n1,
"RemoteIpv4", Ipv4Address ("10.1.2.2"),
"RemotePort", Uinteger (port),
@@ -145,7 +145,7 @@
"PacketSize", Uinteger (1024));
n1->AddApplication (client1);
Ptr<UdpEchoClient> client2 =
- CreateObjectWith<UdpEchoClient> (
+ CreateObject<UdpEchoClient> (
"Node", n2,
"RemoteIpv4", Ipv4Address ("10.1.2.3"),
"RemotePort", Uinteger (port),
@@ -154,7 +154,7 @@
"PacketSize", Uinteger (1024));
n2->AddApplication (client2);
Ptr<UdpEchoClient> client3 =
- CreateObjectWith<UdpEchoClient> (
+ CreateObject<UdpEchoClient> (
"Node", n3,
"RemoteIpv4", Ipv4Address ("10.1.2.4"),
"RemotePort", Uinteger (port),
@@ -164,16 +164,16 @@
n3->AddApplication (client3);
Ptr<UdpEchoServer> server4 =
- CreateObjectWith<UdpEchoServer> ("Node", n4, "Port", Uinteger (port));
+ CreateObject<UdpEchoServer> ("Node", n4, "Port", Uinteger (port));
n4->AddApplication (server4);
Ptr<UdpEchoServer> server5 =
- CreateObjectWith<UdpEchoServer> ("Node", n5, "Port", Uinteger (port));
+ CreateObject<UdpEchoServer> ("Node", n5, "Port", Uinteger (port));
n5->AddApplication (server5);
Ptr<UdpEchoServer> server6 =
- CreateObjectWith<UdpEchoServer> ("Node", n6, "Port", Uinteger (port));
+ CreateObject<UdpEchoServer> ("Node", n6, "Port", Uinteger (port));
n6->AddApplication (server6);
Ptr<UdpEchoServer> server7 =
- CreateObjectWith<UdpEchoServer> ("Node", n7, "Port", Uinteger (port));
+ CreateObject<UdpEchoServer> ("Node", n7, "Port", Uinteger (port));
n7->AddApplication (server7);
server4->Start(Seconds(1.));
--- a/tutorial/tutorial-point-to-point.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-point-to-point.cc Tue Mar 11 13:30:12 2008 -0700
@@ -61,7 +61,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -70,7 +70,7 @@
n0->AddApplication (client);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1,
+ CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
--- a/tutorial/tutorial-star-routing.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-star-routing.cc Tue Mar 11 13:30:12 2008 -0700
@@ -148,7 +148,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n4,
+ CreateObject<UdpEchoClient> ("Node", n4,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -157,7 +157,7 @@
n0->AddApplication (client);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1,
+ CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
--- a/tutorial/tutorial-star.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/tutorial/tutorial-star.cc Tue Mar 11 13:30:12 2008 -0700
@@ -148,7 +148,7 @@
uint16_t port = 7;
Ptr<UdpEchoClient> client =
- CreateObjectWith<UdpEchoClient> ("Node", n0,
+ CreateObject<UdpEchoClient> ("Node", n0,
"RemoteIpv4", Ipv4Address ("10.1.1.2"),
"RemotePort", Uinteger (port),
"MaxPackets", Uinteger (1),
@@ -157,7 +157,7 @@
n0->AddApplication (client);
Ptr<UdpEchoServer> server =
- CreateObjectWith<UdpEchoServer> ("Node", n1,
+ CreateObject<UdpEchoServer> ("Node", n1,
"Port", Uinteger (port));
n1->AddApplication (server);
--- a/utils/print-introspected-doxygen.cc Tue Mar 11 11:35:26 2008 -0700
+++ b/utils/print-introspected-doxygen.cc Tue Mar 11 13:30:12 2008 -0700
@@ -17,11 +17,11 @@
Ptr<Node> node = CreateObject<InternetNode> ();
node->AggregateObject (CreateObject<MobilityModelNotifier> ());
- Ptr<PointToPointNetDevice> p2p = CreateObjectWith<PointToPointNetDevice> ("Node", node,
+ Ptr<PointToPointNetDevice> p2p = CreateObject<PointToPointNetDevice> ("Node", node,
"Address", Mac48Address::Allocate ());
node->AddDevice (p2p);
p2p->AddQueue (CreateObject<DropTailQueue> ());
- Ptr<CsmaNetDevice> csma = CreateObjectWith<CsmaNetDevice> ("Node", node,
+ Ptr<CsmaNetDevice> csma = CreateObject<CsmaNetDevice> ("Node", node,
"Address", Mac48Address::Allocate (),
"EncapsulationMode", String ("Llc"));
node->AddDevice (csma);