examples/simple-p2p.cc
changeset 568 e1660959ecbb
parent 567 6fb98941c36f
child 571 ac324a1cba74
--- a/examples/simple-p2p.cc	Thu May 10 18:33:52 2007 +0200
+++ b/examples/simple-p2p.cc	Thu May 10 20:19:26 2007 +0200
@@ -107,15 +107,15 @@
   Ptr<Node> n3 = new InternetNode ();
 
   // We create the channels first without any IP addressing information
-  PointToPointChannel *channel0 = 
+  Ptr<PointToPointChannel> channel0 = 
     PointToPointTopology::AddPointToPointLink (
       n0, n2, DataRate(5000000), MilliSeconds(2));
 
-  PointToPointChannel *channel1 = 
+  Ptr<PointToPointChannel> channel1 = 
     PointToPointTopology::AddPointToPointLink (
       n1, n2, DataRate(5000000), MilliSeconds(2));
   
-  PointToPointChannel *channel2 = 
+  Ptr<PointToPointChannel> channel2 = 
     PointToPointTopology::AddPointToPointLink (
       n2, n3, DataRate(1500000), MilliSeconds(10));
   
@@ -123,17 +123,14 @@
   PointToPointTopology::AddIpv4Addresses (
       channel0, n0, Ipv4Address("10.1.1.1"),
       n2, Ipv4Address("10.1.1.2"));
-  channel0->Unref ();
   
   PointToPointTopology::AddIpv4Addresses (
       channel1, n1, Ipv4Address("10.1.2.1"),
       n2, Ipv4Address("10.1.2.2"));
-  channel1->Unref ();
   
   PointToPointTopology::AddIpv4Addresses (
       channel2, n2, Ipv4Address("10.1.3.1"),
       n3, Ipv4Address("10.1.3.2"));
-  channel2->Unref ();
 
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s
@@ -146,10 +143,8 @@
     DataRate(448000), 
     210);
   // Add to Node's ApplicationList (takes ownership of pointer)
-  ApplicationList *apl0 = n0->QueryInterface<ApplicationList> 
-    (ApplicationList::iid);
+  Ptr<ApplicationList> apl0 = n0->QueryInterface<ApplicationList> (ApplicationList::iid);
   apl0->Add(ooff0);
-  apl0->Unref ();
 
   // Start the application
   ooff0->Start(Seconds(1.0));
@@ -165,22 +160,19 @@
     DataRate(448000), 
     210);
   // Add to Node's ApplicationList (takes ownership of pointer)
-  ApplicationList *apl3 = n3->QueryInterface<ApplicationList> (ApplicationList::iid);
+  Ptr<ApplicationList> apl3 = n3->QueryInterface<ApplicationList> (ApplicationList::iid);
   apl3->Add(ooff1);
-  apl3->Unref ();
   // Start the application
   ooff1->Start(Seconds(1.1));
   ooff1->Stop (Seconds(10.0));
 
   // Here, finish off packet routing configuration
   // This will likely set by some global StaticRouting object in the future
-  IIpv4 *ipv4;
+  Ptr<IIpv4> ipv4;
   ipv4 = n0->QueryInterface<IIpv4> (IIpv4::iid);
   ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
-  ipv4->Unref ();
   ipv4 = n3->QueryInterface<IIpv4> (IIpv4::iid);
   ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
-  ipv4->Unref ();
 
   n0 = 0;
   n1 = 0;