Adapt OLSR to routing API changes
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed, 12 Sep 2007 18:28:18 +0100
changeset 1745 0e8301827889
parent 1744 d658b8810b5a
child 1746 f4913893aea9
Adapt OLSR to routing API changes
examples/simple-point-to-point-olsr.cc
src/routing/olsr/routing-table.cc
src/routing/olsr/routing-table.h
--- a/examples/simple-point-to-point-olsr.cc	Wed Sep 12 18:06:09 2007 +0100
+++ b/examples/simple-point-to-point-olsr.cc	Wed Sep 12 18:28:18 2007 +0100
@@ -184,7 +184,6 @@
   // Start the sink
   sink->Start (Seconds (1.1));
   sink->Stop (Seconds (10.0));
-  sink->SetQuiet ();  // disable output from the Receive callback
 
   // Here, finish off packet routing configuration
   // This will likely set by some global StaticRouting object in the future
--- a/src/routing/olsr/routing-table.cc	Wed Sep 12 18:06:09 2007 +0100
+++ b/src/routing/olsr/routing-table.cc	Wed Sep 12 18:28:18 2007 +0100
@@ -106,7 +106,8 @@
 
 
 bool
-RoutingTable::RequestRoute (const Ipv4Header &ipHeader,
+RoutingTable::RequestRoute (uint32_t ifIndex,
+                            const Ipv4Header &ipHeader,
                             Packet packet,
                             RouteReplyCallback routeReply)
 {
@@ -135,6 +136,24 @@
     }
 }
 
+bool
+RoutingTable::RequestIfIndex (Ipv4Address destination,
+                              uint32_t& ifIndex)
+{
+  RoutingTableEntry entry1, entry2;
+  if (Lookup (destination, entry1))
+    {
+      bool foundSendEntry = FindSendEntry (entry1, entry2);
+      NS_ASSERT (foundSendEntry);
+      ifIndex = entry2.interface;
+      return true;
+    }
+  else
+    {
+      return false;
+    }
+}
+
 
 ///
 /// \brief Adds a new entry into the routing table.
--- a/src/routing/olsr/routing-table.h	Wed Sep 12 18:06:09 2007 +0100
+++ b/src/routing/olsr/routing-table.h	Wed Sep 12 18:28:18 2007 +0100
@@ -100,9 +100,13 @@
                       RoutingTableEntry &outEntry) const;
 
   // From Ipv4RoutingProtocol
-  virtual bool RequestRoute (const Ipv4Header &ipHeader,
+  virtual bool RequestRoute (uint32_t ifIndex,
+                             const Ipv4Header &ipHeader,
                              Packet packet,
                              RouteReplyCallback routeReply);
+  virtual bool RequestIfIndex (Ipv4Address destination, 
+                               uint32_t& ifIndex);
+
 };
 
 }}; // namespace ns3, olsr