src/internet-stack/ipv4-static-routing-impl.cc
changeset 4472 e20a31541404
child 4528 49927f942aea
equal deleted inserted replaced
4471:ef1730710767 4472:e20a31541404
       
     1 // -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
       
     2 //
       
     3 // Copyright (c) 2006 Georgia Tech Research Corporation
       
     4 //
       
     5 // This program is free software; you can redistribute it and/or modify
       
     6 // it under the terms of the GNU General Public License version 2 as
       
     7 // published by the Free Software Foundation;
       
     8 //
       
     9 // This program is distributed in the hope that it will be useful,
       
    10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 // GNU General Public License for more details.
       
    13 //
       
    14 // You should have received a copy of the GNU General Public License
       
    15 // along with this program; if not, write to the Free Software
       
    16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17 //
       
    18 // Author: George F. Riley<riley@ece.gatech.edu>
       
    19 //         Gustavo Carneiro <gjc@inescporto.pt>
       
    20 
       
    21 #include "ns3/log.h"
       
    22 #include "ns3/packet.h"
       
    23 #include "ns3/node.h"
       
    24 #include "ns3/ipv4-route.h"
       
    25 #include "ipv4-static-routing-impl.h"
       
    26 #include "ns3/ipv4-routing-table-entry.h"
       
    27 
       
    28 NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRoutingImpl");
       
    29 
       
    30 namespace ns3 {
       
    31 
       
    32 NS_OBJECT_ENSURE_REGISTERED (Ipv4StaticRoutingImpl);
       
    33 
       
    34 TypeId
       
    35 Ipv4StaticRoutingImpl::GetTypeId (void)
       
    36 {
       
    37   static TypeId tid = TypeId ("ns3::Ipv4StaticRoutingImpl")
       
    38     .SetParent<Ipv4StaticRouting> ()
       
    39     ;
       
    40   return tid;
       
    41 }
       
    42 
       
    43 Ipv4StaticRoutingImpl::Ipv4StaticRoutingImpl () 
       
    44 : m_defaultRoute (0), m_node (0)
       
    45 {
       
    46   NS_LOG_FUNCTION_NOARGS ();
       
    47 }
       
    48 
       
    49 void 
       
    50 Ipv4StaticRoutingImpl::AddHostRouteTo (Ipv4Address dest, 
       
    51                                    Ipv4Address nextHop, 
       
    52                                    uint32_t interface)
       
    53 {
       
    54   NS_LOG_FUNCTION_NOARGS ();
       
    55   Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
       
    56   *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, nextHop, interface);
       
    57   m_hostRoutes.push_back (route);
       
    58 }
       
    59 
       
    60 void 
       
    61 Ipv4StaticRoutingImpl::AddHostRouteTo (Ipv4Address dest, 
       
    62                                    uint32_t interface)
       
    63 {
       
    64   NS_LOG_FUNCTION_NOARGS ();
       
    65   Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
       
    66   *route = Ipv4RoutingTableEntry::CreateHostRouteTo (dest, interface);
       
    67   m_hostRoutes.push_back (route);
       
    68 }
       
    69 
       
    70 void 
       
    71 Ipv4StaticRoutingImpl::AddNetworkRouteTo (Ipv4Address network, 
       
    72                                       Ipv4Mask networkMask, 
       
    73                                       Ipv4Address nextHop, 
       
    74                                       uint32_t interface)
       
    75 {
       
    76   NS_LOG_FUNCTION_NOARGS ();
       
    77   Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
       
    78   *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
       
    79                                             networkMask,
       
    80                                             nextHop,
       
    81                                             interface);
       
    82   m_networkRoutes.push_back (route);
       
    83 }
       
    84 
       
    85 void 
       
    86 Ipv4StaticRoutingImpl::AddNetworkRouteTo (Ipv4Address network, 
       
    87                                       Ipv4Mask networkMask, 
       
    88                                       uint32_t interface)
       
    89 {
       
    90   NS_LOG_FUNCTION_NOARGS ();
       
    91   Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
       
    92   *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
       
    93                                             networkMask,
       
    94                                             interface);
       
    95   m_networkRoutes.push_back (route);
       
    96 }
       
    97 
       
    98 void 
       
    99 Ipv4StaticRoutingImpl::SetDefaultRoute (Ipv4Address nextHop, 
       
   100                                     uint32_t interface)
       
   101 {
       
   102   NS_LOG_FUNCTION_NOARGS ();
       
   103   Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
       
   104   *route = Ipv4RoutingTableEntry::CreateDefaultRoute (nextHop, interface);
       
   105   delete m_defaultRoute;
       
   106   m_defaultRoute = route;
       
   107 }
       
   108 
       
   109 void 
       
   110 Ipv4StaticRoutingImpl::AddMulticastRoute(Ipv4Address origin,
       
   111                                      Ipv4Address group,
       
   112                                      uint32_t inputInterface,
       
   113                                      std::vector<uint32_t> outputInterfaces)
       
   114 {
       
   115   NS_LOG_FUNCTION_NOARGS ();
       
   116   Ipv4MulticastRoutingTableEntry *route = new Ipv4MulticastRoutingTableEntry ();
       
   117   *route = Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (origin, group, 
       
   118     inputInterface, outputInterfaces);
       
   119   m_multicastRoutes.push_back (route);
       
   120 }
       
   121 
       
   122 // default multicast routes are stored as a network route
       
   123 // these routes are _not_ consulted in the forwarding process-- only
       
   124 // for originating packets
       
   125 void 
       
   126 Ipv4StaticRoutingImpl::SetDefaultMulticastRoute(uint32_t outputInterface)
       
   127 {
       
   128   NS_LOG_FUNCTION_NOARGS ();
       
   129   Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
       
   130   Ipv4Address network = Ipv4Address ("224.0.0.0");
       
   131   Ipv4Mask networkMask = Ipv4Mask ("240.0.0.0");
       
   132   *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
       
   133                                             networkMask,
       
   134                                             outputInterface);
       
   135   m_networkRoutes.push_back (route);
       
   136 }
       
   137 
       
   138 uint32_t 
       
   139 Ipv4StaticRoutingImpl::GetNMulticastRoutes (void) const
       
   140 {
       
   141   NS_LOG_FUNCTION_NOARGS ();
       
   142   return m_multicastRoutes.size ();
       
   143 }
       
   144 
       
   145 Ipv4MulticastRoutingTableEntry
       
   146 Ipv4StaticRoutingImpl::GetMulticastRoute (uint32_t index) const
       
   147 {
       
   148   NS_LOG_FUNCTION_NOARGS ();
       
   149   NS_ASSERT_MSG(index < m_multicastRoutes.size (),
       
   150     "Ipv4StaticRoutingImpl::GetMulticastRoute ():  Index out of range");
       
   151 
       
   152   if (index < m_multicastRoutes.size ())
       
   153     {
       
   154       uint32_t tmp = 0;
       
   155       for (MulticastRoutesCI i = m_multicastRoutes.begin (); 
       
   156            i != m_multicastRoutes.end (); 
       
   157            i++) 
       
   158         {
       
   159           if (tmp  == index)
       
   160             {
       
   161               return *i;
       
   162             }
       
   163           tmp++;
       
   164         }
       
   165     }
       
   166   return 0;
       
   167 }
       
   168 
       
   169 bool
       
   170 Ipv4StaticRoutingImpl::RemoveMulticastRoute(Ipv4Address origin,
       
   171                                         Ipv4Address group,
       
   172                                         uint32_t inputInterface)
       
   173 {
       
   174   NS_LOG_FUNCTION_NOARGS ();
       
   175   for (MulticastRoutesI i = m_multicastRoutes.begin (); 
       
   176        i != m_multicastRoutes.end (); 
       
   177        i++) 
       
   178     {
       
   179       Ipv4MulticastRoutingTableEntry *route = *i;
       
   180       if (origin == route->GetOrigin () &&
       
   181           group == route->GetGroup () &&
       
   182           inputInterface == route->GetInputInterface ())
       
   183         {
       
   184           delete *i;
       
   185           m_multicastRoutes.erase (i);
       
   186           return true;
       
   187         }
       
   188     }
       
   189   return false;
       
   190 }
       
   191 
       
   192 void 
       
   193 Ipv4StaticRoutingImpl::RemoveMulticastRoute(uint32_t index)
       
   194 {
       
   195   NS_LOG_FUNCTION_NOARGS ();
       
   196   uint32_t tmp = 0;
       
   197   for (MulticastRoutesI i = m_multicastRoutes.begin (); 
       
   198        i != m_multicastRoutes.end (); 
       
   199        i++) 
       
   200     {
       
   201       if (tmp  == index)
       
   202         {
       
   203           delete *i;
       
   204           m_multicastRoutes.erase (i);
       
   205           return;
       
   206         }
       
   207       tmp++;
       
   208     }
       
   209 }
       
   210 
       
   211 Ptr<Ipv4Route>
       
   212 Ipv4StaticRoutingImpl::LookupStatic (Ipv4Address dest)
       
   213 {
       
   214   NS_LOG_FUNCTION_NOARGS ();
       
   215   Ptr<Ipv4Route> rtentry = 0;
       
   216   for (HostRoutesCI i = m_hostRoutes.begin (); 
       
   217        i != m_hostRoutes.end (); 
       
   218        i++) 
       
   219     {
       
   220       NS_ASSERT ((*i)->IsHost ());
       
   221       if ((*i)->GetDest ().IsEqual (dest)) 
       
   222         {
       
   223           NS_LOG_LOGIC ("Found global host route" << *i);
       
   224           Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
       
   225           Ipv4RoutingTableEntry* route = (*i);
       
   226           rtentry = Create<Ipv4Route> ();
       
   227           rtentry->SetDestination (route->GetDest ());
       
   228           // XXX handle multi-address case
       
   229           rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
       
   230           rtentry->SetGateway (route->GetGateway ());
       
   231           uint32_t interfaceIdx = route->GetInterface ();
       
   232           rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
       
   233           return rtentry;
       
   234         }
       
   235     }
       
   236   for (NetworkRoutesI j = m_networkRoutes.begin (); 
       
   237        j != m_networkRoutes.end (); 
       
   238        j++) 
       
   239     {
       
   240       NS_ASSERT ((*j)->IsNetwork ());
       
   241       Ipv4Mask mask = (*j)->GetDestNetworkMask ();
       
   242       Ipv4Address entry = (*j)->GetDestNetwork ();
       
   243       if (mask.IsMatch (dest, entry)) 
       
   244         {
       
   245           NS_LOG_LOGIC ("Found global network route" << *j);
       
   246           Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
       
   247           Ipv4RoutingTableEntry* route = (*j);
       
   248           rtentry = Create<Ipv4Route> ();
       
   249           rtentry->SetDestination (route->GetDest ());
       
   250           // XXX handle multi-address case
       
   251           rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
       
   252           rtentry->SetGateway (route->GetGateway ());
       
   253           uint32_t interfaceIdx = route->GetInterface ();
       
   254           rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
       
   255           return rtentry;
       
   256         }
       
   257     }
       
   258   if (m_defaultRoute != 0) 
       
   259     {
       
   260       NS_ASSERT (m_defaultRoute->IsDefault ());
       
   261       NS_LOG_LOGIC ("Found global network route" << m_defaultRoute);
       
   262       Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
       
   263       Ipv4RoutingTableEntry* route = m_defaultRoute;
       
   264       rtentry = Create<Ipv4Route> ();
       
   265       rtentry->SetDestination (route->GetDest ());
       
   266       // XXX handle multi-address case
       
   267       rtentry->SetSource (ipv4->GetAddress (route->GetInterface(), 0).GetLocal ());
       
   268       rtentry->SetGateway (route->GetGateway ());
       
   269       uint32_t interfaceIdx = route->GetInterface ();
       
   270       rtentry->SetOutputDevice (ipv4->GetNetDevice (interfaceIdx));
       
   271       return rtentry;
       
   272     }
       
   273   return 0;
       
   274 }
       
   275 
       
   276 Ptr<Ipv4MulticastRoute>
       
   277 Ipv4StaticRoutingImpl::LookupStatic (
       
   278   Ipv4Address origin, 
       
   279   Ipv4Address group,
       
   280   uint32_t    interface)
       
   281 {
       
   282   NS_LOG_FUNCTION_NOARGS ();
       
   283   Ptr<Ipv4MulticastRoute> mrtentry = 0;
       
   284 
       
   285   for (MulticastRoutesI i = m_multicastRoutes.begin (); 
       
   286        i != m_multicastRoutes.end (); 
       
   287        i++) 
       
   288     {
       
   289       Ipv4MulticastRoutingTableEntry *route = *i;
       
   290 //
       
   291 // We've been passed an origin address, a multicast group address and an 
       
   292 // interface index.  We have to decide if the current route in the list is
       
   293 // a match.
       
   294 //
       
   295 // The first case is the restrictive case where the origin, group and index
       
   296 // matches.  
       
   297 //
       
   298       if (origin == route->GetOrigin () && group == route->GetGroup ())
       
   299         {
       
   300           // Skipping this case (SSM) for now
       
   301           NS_LOG_LOGIC ("Found multicast source specific route" << *i);
       
   302         }
       
   303       if (group == route->GetGroup ())
       
   304         {
       
   305           if (interface == Ipv4::IF_ANY || 
       
   306               interface == route->GetInputInterface ())
       
   307             {
       
   308               NS_LOG_LOGIC ("Found multicast route" << *i);
       
   309               Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
       
   310               mrtentry = Create<Ipv4MulticastRoute> ();
       
   311               mrtentry->SetGroup (route->GetGroup ());
       
   312               mrtentry->SetOrigin (route->GetOrigin ());
       
   313               mrtentry->SetParent (route->GetInputInterface ());
       
   314               for (uint32_t j = 0; j < route->GetNOutputInterfaces (); j++)
       
   315                 {
       
   316                   if (route->GetOutputInterface (j))
       
   317                     {
       
   318                       NS_LOG_LOGIC ("Setting output interface index " << route->GetOutputInterface (j));
       
   319                       mrtentry->SetOutputTtl (route->GetOutputInterface (j), Ipv4MulticastRoute::MAX_TTL - 1);
       
   320                     }
       
   321                 }
       
   322               return mrtentry;
       
   323             }
       
   324         }
       
   325     }
       
   326   return mrtentry;
       
   327 }
       
   328 
       
   329 uint32_t 
       
   330 Ipv4StaticRoutingImpl::GetNRoutes (void)
       
   331 {
       
   332   NS_LOG_FUNCTION_NOARGS ();
       
   333   uint32_t n = 0;
       
   334   if (m_defaultRoute != 0)
       
   335     {
       
   336       n++;
       
   337     }
       
   338   n += m_hostRoutes.size ();
       
   339   n += m_networkRoutes.size ();
       
   340   return n;
       
   341 }
       
   342 
       
   343 Ipv4RoutingTableEntry
       
   344 Ipv4StaticRoutingImpl::GetDefaultRoute ()
       
   345 {
       
   346   NS_LOG_FUNCTION_NOARGS ();
       
   347   if (m_defaultRoute != 0)
       
   348     {
       
   349       return *m_defaultRoute;
       
   350     }
       
   351   else
       
   352     {
       
   353       return Ipv4RoutingTableEntry ();
       
   354     }
       
   355 }
       
   356 
       
   357 Ipv4RoutingTableEntry 
       
   358 Ipv4StaticRoutingImpl::GetRoute (uint32_t index)
       
   359 {
       
   360   NS_LOG_FUNCTION_NOARGS ();
       
   361   if (index == 0 && m_defaultRoute != 0)
       
   362     {
       
   363       return *m_defaultRoute;
       
   364     }
       
   365   if (index > 0 && m_defaultRoute != 0)
       
   366     {
       
   367       index--;
       
   368     }
       
   369   if (index < m_hostRoutes.size ())
       
   370     {
       
   371       uint32_t tmp = 0;
       
   372       for (HostRoutesCI i = m_hostRoutes.begin (); 
       
   373            i != m_hostRoutes.end (); 
       
   374            i++) 
       
   375         {
       
   376           if (tmp  == index)
       
   377             {
       
   378               return *i;
       
   379             }
       
   380           tmp++;
       
   381         }
       
   382     }
       
   383   index -= m_hostRoutes.size ();
       
   384   uint32_t tmp = 0;
       
   385   for (NetworkRoutesI j = m_networkRoutes.begin (); 
       
   386        j != m_networkRoutes.end (); 
       
   387        j++) 
       
   388     {
       
   389       if (tmp == index)
       
   390         {
       
   391           return *j;
       
   392         }
       
   393       tmp++;
       
   394     }
       
   395   NS_ASSERT (false);
       
   396   // quiet compiler.
       
   397   return 0;
       
   398 }
       
   399 void 
       
   400 Ipv4StaticRoutingImpl::RemoveRoute (uint32_t index)
       
   401 {
       
   402   NS_LOG_FUNCTION_NOARGS ();
       
   403   if (index == 0 && m_defaultRoute != 0)
       
   404     {
       
   405       delete m_defaultRoute;
       
   406       m_defaultRoute = 0;
       
   407     }
       
   408   if (index > 0 && m_defaultRoute != 0)
       
   409     {
       
   410       index--;
       
   411     }
       
   412   if (index < m_hostRoutes.size ())
       
   413     {
       
   414       uint32_t tmp = 0;
       
   415       for (HostRoutesI i = m_hostRoutes.begin (); 
       
   416            i != m_hostRoutes.end (); 
       
   417            i++) 
       
   418         {
       
   419           if (tmp  == index)
       
   420             {
       
   421               delete *i;
       
   422               m_hostRoutes.erase (i);
       
   423               return;
       
   424             }
       
   425           tmp++;
       
   426         }
       
   427     }
       
   428   index -= m_hostRoutes.size ();
       
   429   uint32_t tmp = 0;
       
   430   for (NetworkRoutesI j = m_networkRoutes.begin (); 
       
   431        j != m_networkRoutes.end (); 
       
   432        j++) 
       
   433     {
       
   434       if (tmp == index)
       
   435         {
       
   436           delete *j;
       
   437           m_networkRoutes.erase (j);
       
   438           return;
       
   439         }
       
   440       tmp++;
       
   441     }
       
   442   NS_ASSERT (false);
       
   443 }
       
   444 
       
   445 Ptr<Ipv4Route> 
       
   446 Ipv4StaticRoutingImpl::RouteOutput (const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr)
       
   447 {
       
   448   NS_LOG_FUNCTION (this << header << oif);
       
   449   Ipv4Address destination = header.GetDestination ();
       
   450   Ptr<Ipv4Route> rtentry = 0;
       
   451 
       
   452   // Multicast goes here
       
   453   if (destination.IsMulticast ())
       
   454     {
       
   455       // Note:  Multicast routes for outbound packets are stored in the
       
   456       // normal unicast table.  An implication of this is that it is not
       
   457       // possible to source multicast datagrams on multiple interfaces.
       
   458       // This is a well-known property of sockets implementation on 
       
   459       // many Unix variants.
       
   460       // So, we just log it and fall through to LookupStatic ()
       
   461       NS_LOG_LOGIC ("RouteOutput()::Multicast destination");
       
   462     }
       
   463   rtentry = LookupStatic (destination);
       
   464   if (rtentry)
       
   465     { 
       
   466       sockerr = Socket::ERROR_NOTERROR;
       
   467     }
       
   468   else
       
   469     { 
       
   470       sockerr = Socket::ERROR_NOROUTETOHOST;
       
   471     }
       
   472   return rtentry;
       
   473 }
       
   474 
       
   475 // XXX this method not robust enough to work independent of ListRouting
       
   476 bool 
       
   477 Ipv4StaticRoutingImpl::RouteInput  (Ptr<const Packet> p, const Ipv4Header &ipHeader, Ptr<const NetDevice> idev,
       
   478                              UnicastForwardCallback ucb, MulticastForwardCallback mcb,
       
   479                              LocalDeliverCallback lcb, ErrorCallback ecb)
       
   480 {
       
   481   NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev);
       
   482   Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
       
   483 
       
   484   if (ipHeader.GetDestination ().IsMulticast ())
       
   485     {
       
   486       NS_LOG_LOGIC ("Multicast destination");
       
   487       Ptr<Ipv4MulticastRoute> mrtentry =  LookupStatic(ipHeader.GetSource (),
       
   488         ipHeader.GetDestination (), ipv4->GetInterfaceForDevice (idev));
       
   489 
       
   490       if (mrtentry)
       
   491         {
       
   492           NS_LOG_LOGIC ("Multicast route found");
       
   493           mcb (mrtentry, p, ipHeader); // multicast forwarding callback
       
   494           return true;
       
   495         }
       
   496       else
       
   497         {
       
   498           NS_LOG_LOGIC ("Multicast route not found");
       
   499           return false; // Let other routing protocols try to handle this
       
   500         }
       
   501     }
       
   502 //
       
   503 // This is a unicast packet.  Check to see if we have a route for it.
       
   504 //
       
   505   NS_LOG_LOGIC ("Unicast destination");
       
   506   Ptr<Ipv4Route> rtentry = LookupStatic (ipHeader.GetDestination ());
       
   507   if (rtentry != 0)
       
   508     {
       
   509       NS_LOG_LOGIC ("Found unicast destination- calling unicast callback");
       
   510       ucb (rtentry, p, ipHeader);  // unicast forwarding callback
       
   511       return true;
       
   512     }
       
   513   else
       
   514     {
       
   515       NS_LOG_LOGIC ("Did not find unicast destination- returning false");
       
   516       return false; // Let other routing protocols try to handle this
       
   517     }
       
   518 }
       
   519 
       
   520 Ipv4StaticRoutingImpl::~Ipv4StaticRoutingImpl ()
       
   521 {
       
   522   NS_LOG_FUNCTION_NOARGS ();
       
   523 }
       
   524 
       
   525 void
       
   526 Ipv4StaticRoutingImpl::DoDispose (void)
       
   527 {
       
   528   NS_LOG_FUNCTION_NOARGS ();
       
   529   for (HostRoutesI i = m_hostRoutes.begin (); 
       
   530        i != m_hostRoutes.end (); 
       
   531        i = m_hostRoutes.erase (i)) 
       
   532     {
       
   533       delete (*i);
       
   534     }
       
   535   for (NetworkRoutesI j = m_networkRoutes.begin (); 
       
   536        j != m_networkRoutes.end (); 
       
   537        j = m_networkRoutes.erase (j)) 
       
   538     {
       
   539       delete (*j);
       
   540     }
       
   541   if (m_defaultRoute != 0)
       
   542     {
       
   543       delete m_defaultRoute;
       
   544       m_defaultRoute = 0;
       
   545     }
       
   546   for (MulticastRoutesI i = m_multicastRoutes.begin (); 
       
   547        i != m_multicastRoutes.end (); 
       
   548        i = m_multicastRoutes.erase (i)) 
       
   549     {
       
   550       delete (*i);
       
   551     }
       
   552   Ipv4RoutingProtocol::DoDispose ();
       
   553 }
       
   554 
       
   555 void
       
   556 Ipv4StaticRoutingImpl::SetNode (Ptr<Node> node)
       
   557 {
       
   558   NS_LOG_FUNCTION_NOARGS ();
       
   559   m_node = node;
       
   560 }
       
   561 
       
   562 Ptr<Node>
       
   563 Ipv4StaticRoutingImpl::GetNode (void) const
       
   564 {
       
   565   NS_LOG_FUNCTION_NOARGS ();
       
   566   return m_node; 
       
   567 } 
       
   568 
       
   569 
       
   570 }//namespace ns3