Restructured rtable, queue size moved from protocol setter to attribute
authorKirill Andreev <andreev@iitp.ru>
Fri, 27 Mar 2009 13:46:02 +0300
changeset 4893 d390c2dd2f14
parent 4892 cdd13648776b
child 4894 a6cf8696922a
Restructured rtable, queue size moved from protocol setter to attribute
src/devices/mesh/dot11s/hwmp-protocol.cc
src/devices/mesh/dot11s/hwmp-protocol.h
src/devices/mesh/dot11s/hwmp-rtable.cc
src/devices/mesh/dot11s/hwmp-rtable.h
src/devices/mesh/mesh-l2-routing-protocol.h
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc	Thu Mar 26 21:11:29 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc	Fri Mar 27 13:46:02 2009 +0300
@@ -73,12 +73,6 @@
         MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout),
         MakeTimeChecker ()
         )
-    .AddAttribute ("dot11MeshHWMPactiveRootTimeout",
-        "Lifetime of poractive routing information",
-        TimeValue (MicroSeconds (1024*5000)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactiveRootTimeout),
-        MakeTimeChecker ()
-        )
     .AddAttribute ("dot11MeshHWMPactivePathTimeout",
         "Lifetime of reactive routing information",
         TimeValue (MicroSeconds (1024*5000)),
@@ -96,13 +90,24 @@
         TimeValue (MicroSeconds (1024*5000)),
         MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPrannInterval),
         MakeTimeChecker ()
+        )
+  .AddAttribute ("maxQueueSize",
+        "Maximum number of packets we can store when resolving route",
+        UintegerValue (255),
+        MakeUintegerAccessor (&HwmpProtocol::m_maxQueueSize),
+        MakeUintegerChecker<uint16_t> (1)
+        )
+  .AddAttribute ("maxTtl",
+        "Initial value of Time To Live field",
+        UintegerValue (32),
+        MakeUintegerAccessor (&HwmpProtocol::m_maxTtl),
+        MakeUintegerChecker<uint8_t> (1)
         );
   return tid;
 }
 HwmpProtocol::HwmpProtocol ():
     m_dataSeqno(0),
     m_hwmpSeqno(0),
-    m_maxTtl (32),
     m_rtable (CreateObject<HwmpRtable> ())
 {
 }
@@ -175,7 +180,7 @@
     if (destination == Mac48Address::GetBroadcast ())
     {
       //Reply immediately
-      routeReply (true, packet, source, destination, protocolType, 0xffffffff);
+      routeReply (true, packet, source, destination, protocolType, HwmpRtable::INTERFACE_ANY);
     }
     else
     {
@@ -188,7 +193,7 @@
     NS_ASSERT (packet->FindFirstMatchingTag(tag));
     if (destination == Mac48Address::GetBroadcast ())
       //reply immediately
-      routeReply (true, packet, source, destination, protocolType, 0xffffffff);
+      routeReply (true, packet, source, destination, protocolType, HwmpRtable::INTERFACE_ANY);
     else
     {
       NS_ASSERT(false);
@@ -222,7 +227,7 @@
         source,
         destination,
         protocolType,
-        HwmpRtable::PORT_ANY
+        HwmpRtable::INTERFACE_ANY
       );
       return true;
     }
@@ -352,7 +357,7 @@
   int position = 0;
   for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
     {
-      if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::PORT_ANY))
+      if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::INTERFACE_ANY))
         {
           if (m_hwmpStates[position]->SetRoot ())
             {
@@ -396,7 +401,7 @@
   int position = 0;
   for (std::vector<Ptr<HwmpProtocolState> >::iterator i = m_hwmpStates.begin (); i != m_hwmpStates.end(); i++)
     {
-      if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::PORT_ANY))
+      if (((*i)->GetAssociatedIfaceId () == port)||(port == HwmpRtable::INTERFACE_ANY))
         {
           m_modes[position] = REACTIVE;
           m_hwmpStates[position]->UnSetRoot ();
@@ -525,66 +530,69 @@
   return retransmitters;
 }
 #endif
-void
-HwmpProtocol::SetMaxQueueSize (int maxPacketsPerDestination)
-{
-}
 bool
 HwmpProtocol::QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet)
 {
-#if 0
-  if ((int)m_rqueue[packet.dst].size () > m_maxQueueSize)
+  if (m_rqueue.size () > m_maxQueueSize)
     return false;
-  m_rqueue[packet.dst].push (packet);
-#endif
+  m_rqueue.push_back (packet);
   return true;
 }
 
 MeshL2RoutingProtocol::QueuedPacket
-HwmpProtocol::DequeuePacket (Mac48Address dst)
+HwmpProtocol::DequeueFirstPacketByDst (Mac48Address dst)
 {
   MeshL2RoutingProtocol::QueuedPacket retval;
-#if 0
   retval.pkt = NULL;
-  //Ptr<Packet> in this structure is NULL when queue is empty
-  std::map<Mac48Address, std::queue<QueuedPacket> >:: iterator i = m_rqueue.find (dst);
-  if (i == m_rqueue.end ())
-    return retval;
-  if ((int)m_rqueue[dst].size () == 0)
-    return retval;
-  if ((int)i->second.size () == 0)
+  for(std::vector<QueuedPacket>::iterator i = m_rqueue.begin (); i != m_rqueue.end (); i++)
+    if((*i).dst == dst)
     {
+      retval = (*i);
       m_rqueue.erase (i);
-      return retval;
+      break;
     }
-  retval = m_rqueue[dst].front ();
-  m_rqueue[dst].pop ();
-#endif
+  return retval;
+}
+MeshL2RoutingProtocol::QueuedPacket
+HwmpProtocol::DequeueFirstPacket ()
+{
+  MeshL2RoutingProtocol::QueuedPacket retval;
+  retval.pkt = NULL;
+  if(m_rqueue.size () != 0)
+    retval = m_rqueue[0];
+  m_rqueue.erase (m_rqueue.begin ());
   return retval;
 }
 void
-HwmpProtocol::SendAllPossiblePackets (Mac48Address dst)
+HwmpProtocol::ReactivePathResolved (Mac48Address dst)
 {
-#if 0
   HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
+  NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ());
+  //Send all packets stored for this destination    
   MeshL2RoutingProtocol::QueuedPacket packet;
   while (1)
+  {
+    packet = DequeueFirstPacketByDst (dst);
+    if (packet.pkt == NULL)
+      return;
+    //set RA tag for retransmitter:
+    HwmpTag tag;
+    NS_ASSERT (packet.pkt->FindFirstMatchingTag(tag));
+    tag.SetAddress (result.retransmitter);
+    packet.pkt->RemoveAllTags ();
+    packet.pkt->AddTag (tag);
+    packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
+  }
+}
+void
+HwmpProtocol::ProactivePathResolved ()
+{
+  //send all packets to root
+  HwmpRtable::LookupResult result = m_rtable->LookupProactive ();
+  NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ());
+  NS_ASSERT(false);
+}
 
-    {
-      packet = DequeuePacket (dst);
-      if (packet.pkt == NULL)
-        return;
-      //set RA tag for retransmitter:
-      HwmpProtocolTag tag;
-      NS_ASSERT (packet.pkt->FindFirstMatchingTag(tag));
-      tag.SetAddress (result.retransmitter);
-      NS_ASSERT (result.retransmitter != Mac48Address::GetBroadcast());
-      packet.pkt->RemoveAllTags ();
-      packet.pkt->AddTag (tag);
-      packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
-    }
-#endif
-}
 bool
 HwmpProtocol::ShouldSendPreq (Mac48Address dst)
 {
@@ -601,8 +609,9 @@
 void
 HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry)
 {
-#if 0
   HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
+  if(result.retransmitter == Mac48Address::GetBroadcast ())
+    result = m_rtable->LookupProactive ();
   if (result.retransmitter != Mac48Address::GetBroadcast ())
     {
       std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
@@ -611,13 +620,13 @@
       return;
     }
   numOfRetry++;
-  if (numOfRetry > dot11sParameters::dot11MeshHWMPmaxPREQretries)
+  if (numOfRetry > m_dot11MeshHWMPmaxPREQretries)
     {
       MeshL2RoutingProtocol::QueuedPacket packet;
       //purge queue and delete entry from retryDatabase
       while (1)
         {
-          packet = DequeuePacket (dst);
+          packet = DequeueFirstPacketByDst (dst);
           if (packet.pkt == NULL)
             break;
           packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
@@ -627,15 +636,11 @@
       m_preqTimeouts.erase (i);
       return;
     }
-#if 0
-  for (unsigned int i = 0; i < m_requestCallback.size (); i++)
-    if ((m_modes[i] == REACTIVE) || (m_modes[i] == ROOT))
-      m_requestCallback[i] (dst);
-#endif
+  //TODO: Request a destination again
+  NS_ASSERT(false);
   m_preqTimeouts[dst] = Simulator::Schedule (
-                             MilliSeconds (2*(dot11sParameters::dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
-                             &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
-#endif
+      MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())),
+      &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
 }
 } //namespace dot11s
 } //namespace ns3
--- a/src/devices/mesh/dot11s/hwmp-protocol.h	Thu Mar 26 21:11:29 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-protocol.h	Fri Mar 27 13:46:02 2009 +0300
@@ -24,6 +24,7 @@
 
 #include "ns3/mesh-l2-routing-protocol.h"
 #include "ns3/nstime.h"
+#include <vector>
 #include <map>
 
 namespace ns3 {
@@ -124,11 +125,15 @@
   //\param Mac48Address is the mesh source addrress of the frame
   bool DropDataFrame(uint32_t, Mac48Address);
 private:
-  void  SetMaxQueueSize (int maxPacketsPerDestination);
-  int  m_maxQueueSize;
-  bool  QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet);
-  MeshL2RoutingProtocol::QueuedPacket  DequeuePacket (Mac48Address dst);
-  void  SendAllPossiblePackets (Mac48Address dst);
+  ///\name Methods related to Queue/Dequeue procedures
+  ///\{
+  uint16_t m_maxQueueSize;
+  bool QueuePacket (MeshL2RoutingProtocol::QueuedPacket packet);
+  QueuedPacket  DequeueFirstPacketByDst (Mac48Address dst);
+  QueuedPacket  DequeueFirstPacket ();
+  void ReactivePathResolved (Mac48Address dst);
+  void ProactivePathResolved ();
+  ///\}
   ///\name Methods responsible for Path discovery retry procedure:
   //\{
   //\brief checks when the last path discovery procedure was started
@@ -155,6 +160,8 @@
   //\{
   std::map<Mac48Address, EventId>  m_preqTimeouts;
   //\}
+  ///\Packet Queue
+  std::vector<QueuedPacket>  m_rqueue;
 private:
   ///\name HWMP-protocol parameters
   ///\{
@@ -168,7 +175,6 @@
   Time m_dot11MeshHWMPrannInterval;
   ///\}
 #if 0
-  std::map<Mac48Address, std::queue<QueuedPacket> >  m_rqueue;
   //devices and HWMP states:
   enum DeviceMode {
     REACTIVE,
@@ -207,35 +213,6 @@
    */
   HwmpRtable::LookupResult  RequestRouteForAddress (const Mac48Address& destination);
   HwmpRtable::LookupResult  RequestRootPathForPort (uint32_t port);
-
-  /**
-   * \attention mesh seqno is processed at HWMP
-   */
-  uint32_t m_seqno;
-  std::map<Mac48Address, uint32_t/**/>  m_seqnoDatabase;
-  //Timers:
-  /**
-   * /brief checks when last preq was initiated, returns
-   * false when retry has not expired
-   */
-  bool  ShouldSendPreq (Mac48Address dst);
-  /**
-   * \brief Generates PREQ retry when route is
-   * still unresolved after first PREQ
-   * If number of retries greater than
-   * dot11sParameters::dot11MeshHWMPmaxPREQretries,
-   * we return all packets to upper layers
-   */
-  void  RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
-  /**
-   * Keeps PREQ retry timers for every
-   * destination
-   */
-  std::map<Mac48Address, EventId>  m_preqTimeouts;
-  /**
-   * Configurable parameters:
-   */
-  bool     m_broadcastPerr;
 #endif
 };
 } //namespace dot11s
--- a/src/devices/mesh/dot11s/hwmp-rtable.cc	Thu Mar 26 21:11:29 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-rtable.cc	Fri Mar 27 13:46:02 2009 +0300
@@ -39,6 +39,7 @@
 }
 HwmpRtable::HwmpRtable ()
 {
+  DeleteProactivePath ();
 }
 HwmpRtable::~HwmpRtable ()
 {
@@ -48,13 +49,12 @@
 HwmpRtable::DoDispose ()
 {
   m_routes.clear ();
-  m_roots.clear ();
 }
 void
 HwmpRtable::AddReactivePath (
   Mac48Address destination,
   Mac48Address retransmitter,
-  uint32_t port,
+  uint32_t interface,
   uint32_t metric,
   Time  lifetime,
   uint32_t seqnum
@@ -69,12 +69,12 @@
   else
     {
       /**
-       * if outport differs from stored, routing info is
+       * if outinterface differs from stored, routing info is
        * actual and metric is worse - we ignore this
        * information
        */
       if (
-        (i->second.port != port) &&
+        (i->second.interface != interface) &&
         (i->second.metric < metric) &&
         /**
          * The routing info is actual or it
@@ -87,7 +87,7 @@
   i = m_routes.find (destination);
   NS_ASSERT (i != m_routes.end());
   i->second.retransmitter = retransmitter;
-  i->second.port = port;
+  i->second.interface = interface;
   i->second.metric = metric;
   if (lifetime != Seconds (0))
     i->second.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
@@ -103,28 +103,25 @@
   uint32_t metric,
   Mac48Address root,
   Mac48Address retransmitter,
-  uint32_t port,
+  uint32_t interface,
   Time  lifetime,
   uint32_t seqnum
 )
 {
-  ProactiveRoute newroute;
-  m_roots[port] = newroute;
-  std::map<uint32_t,ProactiveRoute>::iterator i = m_roots.find (port);
-  NS_ASSERT (i != m_roots.end());
-  i->second.root = root;
-  i->second.retransmitter = retransmitter;
-  i->second.metric = metric;
-  i->second.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
-  i->second.seqnum = seqnum;
+  m_root.root = root;
+  m_root.retransmitter = retransmitter;
+  m_root.metric = metric;
+  m_root.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds());
+  m_root.seqnum = seqnum;
+  m_root.interface = interface;
 }
 void
-HwmpRtable::AddPrecursor (Mac48Address destination, uint32_t port, Mac48Address precursor)
+HwmpRtable::AddPrecursor (Mac48Address destination, uint32_t interface, Mac48Address precursor)
 {
-  bool should_add = true;
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
-  if ((i != m_routes.end ()) && (i->second.port == port))
+  if ((i != m_routes.end ()) && (i->second.interface == interface))
     {
+      bool should_add = true;
       for (unsigned int j = 0 ; j < i->second.precursors.size (); j ++)
         if (i->second.precursors[j] == precursor)
           {
@@ -134,36 +131,28 @@
       if (should_add)
         i->second.precursors.push_back (precursor);
     }
-  std::map<uint32_t,ProactiveRoute>::iterator k = m_roots.find (port);
-  if (k != m_roots.end ())
-    {
-      for (unsigned int j = 0 ; j < k->second.precursors.size (); j ++)
-        if (k->second.precursors[j] == precursor)
-          return;
-      k->second.precursors.push_back (precursor);
-      return;
-    }
+  if((m_root.root == destination) && (m_root.interface == interface))
+    for (unsigned int j = 0 ; j < m_root.precursors.size (); j ++)
+      if (m_root.precursors[j] == precursor)
+        return;
+  m_root.precursors.push_back(precursor);
 }
 void
-HwmpRtable::DeleteProactivePath (uint32_t port)
+HwmpRtable::DeleteProactivePath ()
 {
-  std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find (port);
-  if (j != m_roots.end ())
-    m_roots.erase (j);
+  m_root.precursors.clear ();
+  m_root.interface = INTERFACE_ANY;
+  m_root.metric = MAX_METRIC;
+  m_root.retransmitter = Mac48Address::GetBroadcast ();
+  m_root.seqnum = 0;
+  m_root.whenExpire = Simulator::Now ();
 }
 void
-HwmpRtable::DeleteProactivePath (Mac48Address root, uint32_t port)
-{
-  std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find (port);
-  if ((j != m_roots.end ())&&(j->second.root == root))
-    m_roots.erase (j);
-}
-void
-HwmpRtable::DeleteReactivePath (Mac48Address destination, uint32_t port)
+HwmpRtable::DeleteReactivePath (Mac48Address destination, uint32_t interface)
 {
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   if (i != m_routes.end ())
-    if (i->second.port ==  port)
+    if (i->second.interface ==  interface)
       m_routes.erase (i);
 }
 HwmpRtable::LookupResult
@@ -172,12 +161,12 @@
   LookupResult result;
   result.retransmitter = Mac48Address::GetBroadcast ();
   result.metric = MAX_METRIC;
-  result.ifIndex = PORT_ANY;
+  result.ifIndex = INTERFACE_ANY;
 
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   if (i == m_routes.end ())
     return result;
-  result.ifIndex = i->second.port;
+  result.ifIndex = i->second.interface;
   //Seconds (0) means that this is routing
   if (i->second.whenExpire < Simulator::Now ())
     if (i->second.retransmitter != destination)
@@ -188,29 +177,23 @@
   return result;
 }
 HwmpRtable::LookupResult
-HwmpRtable::LookupProactive (uint32_t port)
+HwmpRtable::LookupProactive ()
 {
-  LookupResult result;
-  result.retransmitter = Mac48Address::GetBroadcast ();
-  result.metric = MAX_METRIC;
-  result.ifIndex = PORT_ANY;
-  std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find (port);
-  if (i == m_roots.end ())
-    return result;
-  result.ifIndex = i->first;
-  if (i->second.whenExpire < Simulator::Now ())
-    return result;
-  result.retransmitter = i->second.retransmitter;
-  result.metric = i->second.metric;
-  result.seqnum = i->second.seqnum;
-  return result;
+  if (m_root.whenExpire < Simulator::Now ())
+    DeleteProactivePath ();
+  LookupResult retval;
+  retval.retransmitter = m_root.retransmitter;
+  retval.ifIndex = m_root.interface;
+  retval.metric = m_root.metric;
+  retval.seqnum = m_root.seqnum;
+  return retval;
 }
 std::vector<IePerr::FailedDestination>
-HwmpRtable::GetUnreachableDestinations (Mac48Address peerAddress, uint32_t port)
+HwmpRtable::GetUnreachableDestinations (Mac48Address peerAddress, uint32_t interface)
 {
   std::vector<IePerr::FailedDestination> retval;
   for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin (); i != m_routes.end(); i++)
-    if ((i->second.retransmitter == peerAddress)&& (i->second.port == port))
+    if ((i->second.retransmitter == peerAddress)&& (i->second.interface == interface))
       {
         IePerr::FailedDestination dst;
         dst.destination = i->first;
@@ -221,12 +204,11 @@
   /**
    * Lookup a path to root
    */
-  std::map<uint32_t, ProactiveRoute>::iterator i = m_roots.find (port);
-  if ((i != m_roots.end ())&&(i->second.retransmitter == peerAddress))
+  if (m_root.retransmitter == peerAddress)
     {
       IePerr::FailedDestination dst;
-      dst.destination = i->second.root;
-      dst.seqnum = i->second.seqnum;
+      dst.destination = m_root.root;
+      dst.seqnum = m_root.seqnum;
       retval.push_back (dst);
     }
   return retval;
@@ -240,21 +222,16 @@
   return i->second.seqnum;
 }
 std::vector<Mac48Address>
-HwmpRtable::GetPrecursors (Mac48Address destination, uint32_t port)
+HwmpRtable::GetPrecursors (Mac48Address destination, uint32_t interface)
 {
   std::vector<Mac48Address> retval;
-  std::map<uint32_t, ProactiveRoute>::iterator root = m_roots.find (port);
-  if ((root != m_roots.end ()) &&(root->second.root == destination))
-    {
-      for (unsigned int i = 0; i < root->second.precursors.size (); i ++)
-        retval.push_back (root->second.precursors[i]);
-    }
+  if (m_root.root == destination)
+      for (unsigned int i = 0; i < m_root.precursors.size (); i ++)
+        retval.push_back (m_root.precursors[i]);
   std::map<Mac48Address, ReactiveRoute>::iterator route = m_routes.find (destination);
-  if ( (route != m_routes.end ()) && (route->second.port == port) )
-    {
+  if ( (route != m_routes.end ()) && (route->second.interface == interface) )
       for (unsigned int i = 0; i < route->second.precursors.size (); i ++)
         retval.push_back (route->second.precursors[i]);
-    }
   return retval;
 }
 } //namespace dot11s
--- a/src/devices/mesh/dot11s/hwmp-rtable.h	Thu Mar 26 21:11:29 2009 +0300
+++ b/src/devices/mesh/dot11s/hwmp-rtable.h	Fri Mar 27 13:46:02 2009 +0300
@@ -41,7 +41,7 @@
   void AddReactivePath (
     Mac48Address destination,
     Mac48Address retransmitter,
-    uint32_t port,
+    uint32_t interface,
     uint32_t metric,
     Time  lifetime,
     uint32_t seqnum
@@ -50,14 +50,13 @@
     uint32_t metric,
     Mac48Address root,
     Mac48Address retransmitter,
-    uint32_t port,
+    uint32_t interface,
     Time  lifetime,
     uint32_t seqnum
   );
-  void AddPrecursor (Mac48Address destination, uint32_t port, Mac48Address precursor);
-  void DeleteProactivePath (uint32_t port);
-  void DeleteProactivePath (Mac48Address root, uint32_t port);
-  void DeleteReactivePath (Mac48Address destination, uint32_t port);
+  void AddPrecursor (Mac48Address destination, uint32_t interface, Mac48Address precursor);
+  void DeleteProactivePath ();
+  void DeleteReactivePath (Mac48Address destination, uint32_t interface);
   struct LookupResult
   {
     Mac48Address retransmitter;
@@ -66,18 +65,18 @@
     uint32_t seqnum;
   };
   LookupResult  LookupReactive (Mac48Address destination);
-  LookupResult  LookupProactive (uint32_t port);
+  LookupResult  LookupProactive ();
   //path error routines:
-  std::vector<IePerr::FailedDestination>  GetUnreachableDestinations (Mac48Address peerAddress, uint32_t port);
+  std::vector<IePerr::FailedDestination>  GetUnreachableDestinations (Mac48Address peerAddress, uint32_t interface);
   uint32_t  RequestSeqnum (Mac48Address dst);
-  std::vector<Mac48Address>  GetPrecursors (Mac48Address destination, uint32_t port);
-  const static uint32_t PORT_ANY = 0xffffffff;
+  std::vector<Mac48Address>  GetPrecursors (Mac48Address destination, uint32_t interface);
+  const static uint32_t INTERFACE_ANY = 0xffffffff;
   const static uint32_t MAX_METRIC = 0xffffffff;
 private:
   struct ReactiveRoute
   {
     Mac48Address retransmitter;
-    uint32_t port;
+    uint32_t interface;
     uint32_t metric;
     Time whenExpire;
     uint32_t seqnum;
@@ -87,13 +86,14 @@
   {
     Mac48Address root;
     Mac48Address retransmitter;
+    uint32_t interface;
     uint32_t metric;
     Time whenExpire;
     uint32_t seqnum;
     std::vector<Mac48Address> precursors;
   };
   std::map<Mac48Address, ReactiveRoute>  m_routes;
-  std::map<uint32_t, ProactiveRoute>  m_roots;
+  ProactiveRoute  m_root;
 };
 } //namespace dot11s
 } //namespace ns3
--- a/src/devices/mesh/mesh-l2-routing-protocol.h	Thu Mar 26 21:11:29 2009 +0300
+++ b/src/devices/mesh/mesh-l2-routing-protocol.h	Fri Mar 27 13:46:02 2009 +0300
@@ -104,37 +104,26 @@
   //\{
   /// Packet waiting its routing inforamation, supposed to be used by all implementations to correctly implement timeouts.
   struct QueuedPacket {
-    Ptr<Packet> pkt;            ///< the packet
-    Mac48Address src;           ///< src address
-    Mac48Address dst;           ///< dst address
-    uint16_t protocol;          ///< protocol number
-    uint32_t inPort;            ///< incoming device interface ID (= mesh point IfID for packets from level 3 and mesh interface ID for packets to forward) 
-    RouteReplyCallback reply;   ///< how to reply
+    Ptr<Packet> pkt; ///< the packet
+    Mac48Address src; ///< src address
+    Mac48Address dst; ///< dst address
+    uint16_t protocol; ///< protocol number
+    uint32_t inInterface; ///< incoming device interface ID. (if packet has come from upper layers, this is Mesh point ID)
+    RouteReplyCallback reply; ///< how to reply
   };
   /**
-   * \brief Set maximum route request queue size per destination
-   * 
-   * Routing Queue is implemented inside the routing protocol and keeps one queue per
-   * destination (to make it easier to find resolved and timed out packets).
-   * 
-   * \param maxPacketsPerDestination    Packets per destination that can be stored inside protocol.
-   */
-  virtual void SetMaxQueueSize (int maxPacketsPerDestination) = 0;
-  /**
-   * \brief Queue route request packet with 'Ethernet header' \return false if the queue is full.
+   * \brief Queue route request packet with 'Ethernet header'
+   * \return false if the queue is full.
    */
   virtual bool QueuePacket (struct QueuedPacket packet) = 0;
   /**
    * \brief Deque packet with 'Ethernet header'
-   * 
    * \param destination The destination address, which identifyes queue.
-   * 
    * \return Ptr<packet> (0 if queue is empty), src, dst, protocol ID, incoming port ID, and reply callback
    */
-  virtual struct QueuedPacket DequeuePacket (Mac48Address destination) = 0;
-  
+  virtual QueuedPacket DequeueFirstPacketByDst (Mac48Address destination) = 0;
+  virtual QueuedPacket DequeueFirstPacket () = 0;
   //\}
-  
 protected:
   /// Host mesh point
   Ptr<MeshPointDevice> m_mp;