src/devices/mesh/dot11s/hwmp-rtable.cc
changeset 5130 b5062e8e0da1
parent 5129 5688b8da4526
child 5132 aee541a30256
equal deleted inserted replaced
5129:5688b8da4526 5130:b5062e8e0da1
    94   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
    94   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
    95   if (i != m_routes.end ())
    95   if (i != m_routes.end ())
    96     {
    96     {
    97       bool should_add = true;
    97       bool should_add = true;
    98       for (unsigned int j = 0; j < i->second.precursors.size (); j++)
    98       for (unsigned int j = 0; j < i->second.precursors.size (); j++)
    99         //NB: Only one active route may exist, so do not check
    99         {
   100         //interface ID, just address
   100           //NB: Only one active route may exist, so do not check
   101         if (i->second.precursors[j].second == precursorAddress)
   101           //interface ID, just address
   102           {
   102           if (i->second.precursors[j].second == precursorAddress)
   103             should_add = false;
   103             {
   104             break;
   104               should_add = false;
   105           }
   105               break;
       
   106             }
       
   107         }
   106       if (should_add)
   108       if (should_add)
   107         {
   109         {
   108           i->second.precursors.push_back (precursor);
   110           i->second.precursors.push_back (precursor);
   109         }
   111         }
   110     }
   112     }
   132 }
   134 }
   133 void
   135 void
   134 HwmpRtable::DeleteProactivePath (Mac48Address root)
   136 HwmpRtable::DeleteProactivePath (Mac48Address root)
   135 {
   137 {
   136   if (m_root.root == root)
   138   if (m_root.root == root)
   137     DeleteProactivePath ();
   139     {
       
   140       DeleteProactivePath ();
       
   141     }
   138 }
   142 }
   139 void
   143 void
   140 HwmpRtable::DeleteReactivePath (Mac48Address destination)
   144 HwmpRtable::DeleteReactivePath (Mac48Address destination)
   141 {
   145 {
   142   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   146   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   191 HwmpRtable::GetUnreachableDestinations (Mac48Address peerAddress)
   195 HwmpRtable::GetUnreachableDestinations (Mac48Address peerAddress)
   192 {
   196 {
   193   IePerr::FailedDestination dst;
   197   IePerr::FailedDestination dst;
   194   std::vector<IePerr::FailedDestination> retval;
   198   std::vector<IePerr::FailedDestination> retval;
   195   for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin (); i != m_routes.end (); i++)
   199   for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin (); i != m_routes.end (); i++)
   196     if (i->second.retransmitter == peerAddress)
   200   {
   197       {
   201       if (i->second.retransmitter == peerAddress)
   198         dst.destination = i->first;
   202         {
   199         i->second.seqnum++;
   203           dst.destination = i->first;
   200         dst.seqnum = i->second.seqnum;
   204           i->second.seqnum++;
   201         retval.push_back (dst);
   205           dst.seqnum = i->second.seqnum;
   202       }
   206           retval.push_back (dst);
       
   207         }
       
   208   }
   203   //Lookup a path to root
   209   //Lookup a path to root
   204   if (m_root.retransmitter == peerAddress)
   210   if (m_root.retransmitter == peerAddress)
   205     {
   211     {
   206       dst.destination = m_root.root;
   212       dst.destination = m_root.root;
   207       dst.seqnum = m_root.seqnum;
   213       dst.seqnum = m_root.seqnum;
   226     {
   232     {
   227       for (unsigned int i = 0; i < m_root.precursors.size (); i++)
   233       for (unsigned int i = 0; i < m_root.precursors.size (); i++)
   228         {
   234         {
   229           bool should_add = true;
   235           bool should_add = true;
   230           for (unsigned int j = 0; j < retval.size (); j++)
   236           for (unsigned int j = 0; j < retval.size (); j++)
   231             if (retval[j].second == m_root.precursors[i].second)
   237             {
   232               {
   238               if (retval[j].second == m_root.precursors[i].second)
   233                 should_add = false;
   239                 {
   234                 break;
   240                   should_add = false;
   235               }
   241                   break;
       
   242                 }
       
   243             }
   236           if (should_add)
   244           if (should_add)
   237             retval.push_back (m_root.precursors[i]);
   245             {
       
   246               retval.push_back (m_root.precursors[i]);
       
   247             }
   238         }
   248         }
   239     }
   249     }
   240   return retval;
   250   return retval;
   241 }
   251 }
   242 bool
   252 bool