|
|
| 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 |
Time now = Simulator::Now (); |
| 2966 |
|
| 2967 |
#ifdef NS3_LOG_ENABLE |
| 2968 |
NS_LOG_DEBUG ("Dumping for node with main address " << m_mainAddress); |
| 2969 |
NS_LOG_DEBUG (" Neighbor set"); |
| 2970 |
for (NeighborSet::const_iterator iter = m_state.GetNeighbors ().begin (); |
| 2971 |
iter != m_state.GetNeighbors ().end (); iter++) |
| 2972 |
{ |
| 2973 |
NS_LOG_DEBUG (" " << *iter); |
| 2974 |
} |
| 2975 |
NS_LOG_DEBUG (" Two-hop neighbor set"); |
| 2976 |
for (TwoHopNeighborSet::const_iterator iter = m_state.GetTwoHopNeighbors ().begin (); |
| 2977 |
iter != m_state.GetTwoHopNeighbors ().end (); iter++) |
| 2978 |
{ |
| 2979 |
if (now < iter->expirationTime) |
| 2980 |
{ |
| 2981 |
NS_LOG_DEBUG (" " << *iter); |
| 2982 |
} |
| 2983 |
} |
| 2984 |
NS_LOG_DEBUG (" Routing table"); |
| 2985 |
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator iter = m_table.begin (); iter != m_table.end (); iter++) |
| 2986 |
{ |
| 2987 |
NS_LOG_DEBUG (" dest=" << iter->first << " --> next=" << iter->second.nextAddr << " via interface " << iter->second.interface); |
| 2988 |
} |
| 2989 |
NS_LOG_DEBUG (""); |
| 2990 |
#endif //NS3_LOG_ENABLE |
| 2991 |
} |
| 2959 |
|
2992 |
|
| 2960 |
}} // namespace olsr, ns3 |
2993 |
}} // namespace olsr, ns3 |
| 2961 |
|
2994 |
|