Add more debug info to olsr routing table
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri Feb 01 18:24:39 2008 +0000 (2008-02-01)
changeset 2297127c9adfd39f
parent 2296 15c4fbd9c7c6
child 2298 f61e41169911
Add more debug info to olsr routing table
src/routing/olsr/routing-table.cc
     1.1 --- a/src/routing/olsr/routing-table.cc	Fri Feb 01 18:07:45 2008 +0000
     1.2 +++ b/src/routing/olsr/routing-table.cc	Fri Feb 01 18:24:39 2008 +0000
     1.3 @@ -40,6 +40,7 @@
     1.4  void
     1.5  RoutingTable::Clear ()
     1.6  {
     1.7 +  NS_LOG_FUNCTION;
     1.8    m_table.clear ();
     1.9  }
    1.10  
    1.11 @@ -119,7 +120,7 @@
    1.12        Ipv4Route route = Ipv4Route::CreateHostRouteTo
    1.13          (ipHeader.GetDestination (), entry2.nextAddr, entry2.interface);
    1.14  
    1.15 -      NS_LOG_DEBUG ("Olsr node" << m_mainAddress
    1.16 +      NS_LOG_DEBUG ("Olsr node " << m_mainAddress
    1.17                      << ": RouteRequest for dest=" << ipHeader.GetDestination ()
    1.18                      << " --> destHop=" << entry2.nextAddr
    1.19                      << " interface=" << entry2.interface);
    1.20 @@ -129,9 +130,19 @@
    1.21      }
    1.22    else
    1.23      {
    1.24 -      NS_LOG_DEBUG ("Olsr node" << m_mainAddress
    1.25 +      NS_LOG_DEBUG ("Olsr node " << m_mainAddress
    1.26                      << ": RouteRequest for dest=" << ipHeader.GetDestination ()
    1.27 -                    << " --> NOT FOUND");
    1.28 +                    << " --> NOT FOUND; ** Dumping routing table...");
    1.29 +#if 0
    1.30 +      for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin ();
    1.31 +           iter != m_table.end (); iter++)
    1.32 +        {
    1.33 +          NS_LOG_DEBUG ("dest=" << iter->first << " --> next=" << iter->second.nextAddr
    1.34 +                        << " via interface " << iter->second.interface);
    1.35 +        }
    1.36 +
    1.37 +      NS_LOG_DEBUG ("** Routing table dump end.");
    1.38 +#endif
    1.39        return false;
    1.40      }
    1.41  }
    1.42 @@ -172,6 +183,14 @@
    1.43                          uint32_t interface,
    1.44                          uint32_t distance)
    1.45  {
    1.46 +  NS_LOG_PARAMS_BEGIN ();
    1.47 +  NS_LOG_PARAM (this);
    1.48 +  NS_LOG_PARAM (dest);
    1.49 +  NS_LOG_PARAM (next);
    1.50 +  NS_LOG_PARAM (interface);
    1.51 +  NS_LOG_PARAM (distance);
    1.52 +  NS_LOG_PARAM (m_mainAddress);
    1.53 +  NS_LOG_PARAMS_END ();
    1.54    // Creates a new rt entry with specified values
    1.55    RoutingTableEntry &entry = m_table[dest];
    1.56  
    1.57 @@ -187,6 +206,14 @@
    1.58                          Ipv4Address const &interfaceAddress,
    1.59                          uint32_t distance)
    1.60  {
    1.61 +  NS_LOG_PARAMS_BEGIN ();
    1.62 +  NS_LOG_PARAM (this);
    1.63 +  NS_LOG_PARAM (dest);
    1.64 +  NS_LOG_PARAM (next);
    1.65 +  NS_LOG_PARAM (interfaceAddress);
    1.66 +  NS_LOG_PARAM (distance);
    1.67 +  NS_LOG_PARAM (m_mainAddress);
    1.68 +  NS_LOG_PARAMS_END ();
    1.69    RoutingTableEntry entry;
    1.70    NS_ASSERT (m_ipv4);
    1.71    for (uint32_t i = 0; i < m_ipv4->GetNInterfaces (); i++)