diff -r ecd61941c854 src/routing/olsr/olsr-routing-protocol.cc --- a/src/routing/olsr/olsr-routing-protocol.cc Sat Dec 19 17:54:08 2009 +0300 +++ b/src/routing/olsr/olsr-routing-protocol.cc Sun Dec 20 15:00:42 2009 -0800 @@ -140,7 +140,7 @@ namespace ns3 { namespace olsr { -NS_LOG_COMPONENT_DEFINE ("OlsrAgent"); +NS_LOG_COMPONENT_DEFINE ("OlsrRoutingProtocol"); /********** OLSR class **********/ @@ -2641,12 +2641,15 @@ rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); sockerr = Socket::ERROR_NOTERROR; NS_LOG_DEBUG ("Olsr node " << m_mainAddress - << ": RouteRequest for dest=" << header.GetDestination () + << ": RouteOutput for dest=" << header.GetDestination () << " --> nextHop=" << entry2.nextAddr << " interface=" << entry2.interface); NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () << " and output dev " << rtentry->GetOutputDevice()); } else { + NS_LOG_DEBUG ("Olsr node " << m_mainAddress + << ": RouteOutput for dest=" << header.GetDestination () + << " No route to host"); sockerr = Socket::ERROR_NOROUTETOHOST; } return rtentry; @@ -2706,7 +2709,7 @@ rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); NS_LOG_DEBUG ("Olsr node " << m_mainAddress - << ": RouteRequest for dest=" << header.GetDestination () + << ": RouteInput for dest=" << header.GetDestination () << " --> nextHop=" << entry2.nextAddr << " interface=" << entry2.interface); @@ -2717,7 +2720,7 @@ { #ifdef NS3_LOG_ENABLE NS_LOG_DEBUG ("Olsr node " << m_mainAddress - << ": RouteRequest for dest=" << header.GetDestination () + << ": RouteInput for dest=" << header.GetDestination () << " --> NOT FOUND; ** Dumping routing table..."); for (std::map::const_iterator iter = m_table.begin (); iter != m_table.end (); iter++) { NS_LOG_DEBUG ("dest=" << iter->first << " --> next=" << iter->second.nextAddr @@ -2956,6 +2959,31 @@ return false; } +void +RoutingProtocol::Dump (void) +{ +#ifdef NS3_LOG_ENABLE + NS_LOG_DEBUG ("Dumping for node with main address " << m_mainAddress); + NS_LOG_DEBUG (" Neighbor set"); + for (NeighborSet::const_iterator iter = m_state.GetNeighbors ().begin (); + iter != m_state.GetNeighbors ().end (); iter++) + { + NS_LOG_DEBUG (" " << iter->neighborMainAddr << " status:" << iter->status << " willingness:" << (int) iter->willingness); + } + NS_LOG_DEBUG (" Two-hop neighbor set"); + for (TwoHopNeighborSet::const_iterator iter = m_state.GetTwoHopNeighbors ().begin (); + iter != m_state.GetTwoHopNeighbors ().end (); iter++) + { + NS_LOG_DEBUG (" " << iter->neighborMainAddr << "->" << iter->twoHopNeighborAddr); + } + NS_LOG_DEBUG (" Routing table"); + for (std::map::const_iterator iter = m_table.begin (); iter != m_table.end (); iter++) + { + NS_LOG_DEBUG (" dest=" << iter->first << " --> next=" << iter->second.nextAddr << " via interface " << iter->second.interface); + } + NS_LOG_DEBUG (""); +#endif //NS3_LOG_ENABLE +} }} // namespace olsr, ns3 diff -r ecd61941c854 src/routing/olsr/olsr-routing-protocol.h --- a/src/routing/olsr/olsr-routing-protocol.h Sat Dec 19 17:54:08 2009 +0300 +++ b/src/routing/olsr/olsr-routing-protocol.h Sun Dec 20 15:00:42 2009 -0800 @@ -81,6 +81,8 @@ void SetMainInterface (uint32_t interface); + void Dump (void); + protected: virtual void DoStart (void); private: diff -r ecd61941c854 src/routing/olsr/olsr.h --- a/src/routing/olsr/olsr.h Sat Dec 19 17:54:08 2009 +0300 +++ b/src/routing/olsr/olsr.h Sun Dec 20 15:00:42 2009 -0800 @@ -49,10 +49,10 @@ * node); or ns3::OlsrHelper::InstallAll (void); * * In addition, the behavior of OLSR can be modified by changing certain - * attributes. The method ns3::OlsrHelper::SetAgent () can be used + * attributes. The method ns3::OlsrHelper::Set () can be used * to set OLSR attributes. These include HelloInterval, TcInterval, * MidInterval, Willingness. Other parameters are defined as macros - * in olsr-agent-impl.cc. + * in olsr-routing-protocol.cc. */