|
140 |
namespace ns3 { |
140 |
namespace ns3 { |
141 |
namespace olsr { |
141 |
namespace olsr { |
142 |
|
142 |
|
143 |
NS_LOG_COMPONENT_DEFINE ("OlsrAgent"); |
143 |
NS_LOG_COMPONENT_DEFINE ("OlsrRoutingProtocol"); |
144 |
|
144 |
|
145 |
|
145 |
|
146 |
/********** OLSR class **********/ |
146 |
/********** OLSR class **********/ |
|
2641 |
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); |
2641 |
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); |
2642 |
sockerr = Socket::ERROR_NOTERROR; |
2642 |
sockerr = Socket::ERROR_NOTERROR; |
2643 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2643 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2644 |
<< ": RouteRequest for dest=" << header.GetDestination () |
2644 |
<< ": RouteOutput for dest=" << header.GetDestination () |
2645 |
<< " --> nextHop=" << entry2.nextAddr |
2645 |
<< " --> nextHop=" << entry2.nextAddr |
2646 |
<< " 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()); |
2646 |
<< " 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()); |
2647 |
} |
2647 |
} |
2648 |
else |
2648 |
else |
2649 |
{ |
2649 |
{ |
|
|
2650 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2651 |
<< ": RouteOutput for dest=" << header.GetDestination () |
2652 |
<< " No route to host"); |
2650 |
sockerr = Socket::ERROR_NOROUTETOHOST; |
2653 |
sockerr = Socket::ERROR_NOROUTETOHOST; |
2651 |
} |
2654 |
} |
2652 |
return rtentry; |
2655 |
return rtentry; |
|
2706 |
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); |
2709 |
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx)); |
2707 |
|
2710 |
|
2708 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2711 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2709 |
<< ": RouteRequest for dest=" << header.GetDestination () |
2712 |
<< ": RouteInput for dest=" << header.GetDestination () |
2710 |
<< " --> nextHop=" << entry2.nextAddr |
2713 |
<< " --> nextHop=" << entry2.nextAddr |
2711 |
<< " interface=" << entry2.interface); |
2714 |
<< " interface=" << entry2.interface); |
2712 |
|
2715 |
|
|
2717 |
{ |
2720 |
{ |
2718 |
#ifdef NS3_LOG_ENABLE |
2721 |
#ifdef NS3_LOG_ENABLE |
2719 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2722 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress |
2720 |
<< ": RouteRequest for dest=" << header.GetDestination () |
2723 |
<< ": RouteInput for dest=" << header.GetDestination () |
2721 |
<< " --> NOT FOUND; ** Dumping routing table..."); for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin (); |
2724 |
<< " --> NOT FOUND; ** Dumping routing table..."); for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin (); |
2722 |
iter != m_table.end (); iter++) |
2725 |
iter != m_table.end (); iter++) |
2723 |
{ NS_LOG_DEBUG ("dest=" << iter->first << " --> next=" << iter->second.nextAddr |
2726 |
{ NS_LOG_DEBUG ("dest=" << iter->first << " --> next=" << iter->second.nextAddr |
|
2956 |
return false; |
2959 |
return false; |
2957 |
} |
2960 |
} |
2958 |
|
2961 |
|
|
|
2962 |
void |
2963 |
RoutingProtocol::Dump (void) |
2964 |
{ |
2965 |
#ifdef NS3_LOG_ENABLE |
2966 |
NS_LOG_DEBUG ("Dumping for node with main address " << m_mainAddress); |
2967 |
NS_LOG_DEBUG (" Neighbor set"); |
2968 |
for (NeighborSet::const_iterator iter = m_state.GetNeighbors ().begin (); |
2969 |
iter != m_state.GetNeighbors ().end (); iter++) |
2970 |
{ |
2971 |
NS_LOG_DEBUG (" " << iter->neighborMainAddr << " status:" << iter->status << " willingness:" << (int) iter->willingness); |
2972 |
} |
2973 |
NS_LOG_DEBUG (" Two-hop neighbor set"); |
2974 |
for (TwoHopNeighborSet::const_iterator iter = m_state.GetTwoHopNeighbors ().begin (); |
2975 |
iter != m_state.GetTwoHopNeighbors ().end (); iter++) |
2976 |
{ |
2977 |
NS_LOG_DEBUG (" " << iter->neighborMainAddr << "->" << iter->twoHopNeighborAddr); |
2978 |
} |
2979 |
NS_LOG_DEBUG (" Routing table"); |
2980 |
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin (); iter != m_table.end (); iter++) |
2981 |
{ |
2982 |
NS_LOG_DEBUG (" dest=" << iter->first << " --> next=" << iter->second.nextAddr << " via interface " << iter->second.interface); |
2983 |
} |
2984 |
NS_LOG_DEBUG (""); |
2985 |
#endif //NS3_LOG_ENABLE |
2986 |
} |
2959 |
|
2987 |
|
2960 |
}} // namespace olsr, ns3 |
2988 |
}} // namespace olsr, ns3 |
2961 |
|
2989 |
|