src/internet-stack/ipv4-l3-protocol.cc
changeset 4377 2a05a47dba22
parent 4375 db81fdcb06e7
child 4379 44c7757fb216
--- a/src/internet-stack/ipv4-l3-protocol.cc	Sun Apr 12 22:14:34 2009 -0700
+++ b/src/internet-stack/ipv4-l3-protocol.cc	Sun Apr 12 22:40:31 2009 -0700
@@ -53,7 +53,7 @@
 Ipv4L3Protocol::GetTypeId (void)
 {
   static TypeId tid = TypeId ("ns3::Ipv4L3Protocol")
-    .SetParent<Object> ()
+    .SetParent<Ipv4> ()
     .AddConstructor<Ipv4L3Protocol> ()
     .AddAttribute ("DefaultTtl", "The TTL value set by default on all outgoing packets generated on this node.",
                    UintegerValue (64),
@@ -298,7 +298,7 @@
 
 void
 Ipv4L3Protocol::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol,
-                                    int priority)
+                                    int16_t priority)
 {
   NS_LOG_FUNCTION (this << &routingProtocol << priority);
   m_routingProtocols.push_back
@@ -313,11 +313,11 @@
   return m_staticRouting->GetNRoutes ();
 }
 
-Ipv4Route *
+Ipv4Route 
 Ipv4L3Protocol::GetRoute (uint32_t index)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  return m_staticRouting->GetRoute (index);
+  return *m_staticRouting->GetRoute (index);
 }
 
 void 
@@ -354,11 +354,11 @@
   return m_staticRouting->GetNMulticastRoutes ();
 }
 
-Ipv4MulticastRoute *
+Ipv4MulticastRoute 
 Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const
 {
   NS_LOG_FUNCTION (this << index);
-  return m_staticRouting->GetMulticastRoute (index);
+  return *m_staticRouting->GetMulticastRoute (index);
 }
 
 void 
@@ -476,7 +476,7 @@
 }
 
 int32_t 
-Ipv4L3Protocol::FindInterfaceIndexForDevice (Ptr<NetDevice> device) const
+Ipv4L3Protocol::FindInterfaceForDevice (Ptr<NetDevice> device) const
 {
   NS_LOG_FUNCTION (this << device);
 
@@ -1101,8 +1101,8 @@
       modified = false;
       for (uint32_t i = 0; i < GetNRoutes (); i++)
         {
-          Ipv4Route *route = GetRoute (i);
-          if (route->GetInterface () == ifaceIndex)
+          Ipv4Route route = GetRoute (i);
+          if (route.GetInterface () == ifaceIndex)
             {
               RemoveRoute (i);
               modified = true;
@@ -1143,5 +1143,12 @@
     }
 }
 
+Ptr<NetDevice>
+Ipv4L3Protocol::GetNetDevice (uint32_t i)
+{
+  return GetInterface (i)-> GetDevice ();
+}
+
+
 
 }//namespace ns3