Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(365)

Unified Diff: src/olsr/model/olsr-routing-protocol.cc

Issue 5661044: Bug 1111 - new classes and refactoring RouteOutput()
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/olsr/model/olsr-routing-protocol.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/olsr/model/olsr-routing-protocol.cc
===================================================================
--- a/src/olsr/model/olsr-routing-protocol.cc
+++ b/src/olsr/model/olsr-routing-protocol.cc
@@ -3042,14 +3042,17 @@
}
Ptr<Ipv4Route>
-RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
+RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4FlowI &flowi, Socket::SocketErrno &sockerr)
{
- NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId () << " " << header.GetDestination () << " " << oif);
+ Ipv4Address dst = flowi.GetDestinationAddress();
+ Ptr<NetDevice> oif = flowi.GetOutputIf();
+
+ NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId () << " " << dst << " " << oif);
Ptr<Ipv4Route> rtentry;
RoutingTableEntry entry1, entry2;
bool found = false;
- if (Lookup (header.GetDestination (), entry1) != 0)
+ if (Lookup (dst, entry1) != 0)
{
bool foundSendEntry = FindSendEntry (entry1, entry2);
if (!foundSendEntry)
@@ -3060,10 +3063,10 @@
if (oif && m_ipv4->GetInterfaceForDevice (oif) != static_cast<int> (interfaceIdx))
{
// We do not attempt to perform a constrained routing search
- // if the caller specifies the oif; we just enforce that
- // that the found route matches the requested outbound interface
- NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteOutput for dest=" << header.GetDestination ()
+ // if the caller specifies the oif; we just enforce that
+ // that the found route matches the requested outbound interface
+ NS_LOG_DEBUG ("Olsr node " << m_mainAddress
+ << ": RouteOutput for dest=" << dst
<< " Route interface " << interfaceIdx
<< " does not match requested output interface "
<< m_ipv4->GetInterfaceForDevice (oif));
@@ -3071,9 +3074,9 @@
return rtentry;
}
rtentry = Create<Ipv4Route> ();
- rtentry->SetDestination (header.GetDestination ());
+ rtentry->SetDestination (dst);
// the source address is the interface address that matches
- // the destination address (when multiple are present on the
+ // the destination address (when multiple are present on the
// outgoing interface, one is selected via scoping rules)
NS_ASSERT (m_ipv4);
uint32_t numOifAddresses = m_ipv4->GetNAddresses (interfaceIdx);
@@ -3088,16 +3091,16 @@
rtentry->SetGateway (entry2.nextAddr);
rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceIdx));
sockerr = Socket::ERROR_NOTERROR;
- NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteOutput for dest=" << header.GetDestination ()
+ NS_LOG_DEBUG ("Olsr node " << m_mainAddress
+ << ": RouteOutput for dest=" << dst
<< " --> 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 ());
found = true;
}
else
- {
- rtentry = m_hnaRoutingTable->RouteOutput (p, header, oif, sockerr);
+ {
+ rtentry = m_hnaRoutingTable->RouteOutput (p, flowi, sockerr);
if (rtentry)
{
@@ -3108,8 +3111,8 @@
if (!found)
{
- NS_LOG_DEBUG ("Olsr node " << m_mainAddress
- << ": RouteOutput for dest=" << header.GetDestination ()
+ NS_LOG_DEBUG ("Olsr node " << m_mainAddress
+ << ": RouteOutput for dest=" << dst
<< " No route to host");
sockerr = Socket::ERROR_NOROUTETOHOST;
}
« no previous file with comments | « src/olsr/model/olsr-routing-protocol.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b