[aodv] braces for loops added
authorElena Buchatskaia <borovkovaes@iitp.ru>
Thu, 29 Oct 2009 11:04:47 +0300
changeset 5729 3fe43de9a826
parent 5728 a86a8bbacb60
child 5730 f530c4943146
[aodv] braces for loops added
src/routing/manet/aodv/aodv-neighbor.h
src/routing/manet/aodv/aodv-packet.h
src/routing/manet/aodv/aodv-routing-protocol.cc
src/routing/manet/aodv/aodv-routing-protocol.h
src/routing/manet/aodv/aodv-rqueue.cc
src/routing/manet/aodv/aodv-rqueue.h
src/routing/manet/aodv/aodv-rtable.cc
src/routing/manet/aodv/aodv-rtable.h
src/routing/manet/aodv/aodv-test-suite.cc
src/routing/manet/aodv/aodv.h
--- a/src/routing/manet/aodv/aodv-neighbor.h	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-neighbor.h	Thu Oct 29 11:04:47 2009 +0300
@@ -26,8 +26,8 @@
  *          Pavel Boyko <boyko@iitp.ru>
  */
 
-#ifndef AODVNEIGHBOR_H_
-#define AODVNEIGHBOR_H_
+#ifndef AODVNEIGHBOR_H
+#define AODVNEIGHBOR_H
 
 #include "ns3/simulator.h"
 #include "ns3/timer.h"
@@ -111,4 +111,4 @@
 }
 }
 
-#endif /* AODVNEIGHBOR_H_ */
+#endif /* AODVNEIGHBOR_H */
--- a/src/routing/manet/aodv/aodv-packet.h	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-packet.h	Thu Oct 29 11:04:47 2009 +0300
@@ -25,8 +25,8 @@
  * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
  *          Pavel Boyko <boyko@iitp.ru>
  */
-#ifndef AODVPACKET_H_
-#define AODVPACKET_H_
+#ifndef AODVPACKET_H
+#define AODVPACKET_H
 
 #include <iostream>
 #include "ns3/header.h"
@@ -327,4 +327,4 @@
 std::ostream & operator<< (std::ostream & os, RerrHeader const &);
 }
 }
-#endif /* AODVPACKET_H_ */
+#endif /* AODVPACKET_H */
--- a/src/routing/manet/aodv/aodv-routing-protocol.cc	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-routing-protocol.cc	Thu Oct 29 11:04:47 2009 +0300
@@ -439,7 +439,7 @@
   Ptr<Ipv4L3Protocol> l3 = m_ipv4->GetObject<Ipv4L3Protocol> ();
   if (l3->GetNAddresses (i) > 1)
     {
-      NS_LOG_LOGIC ("AODV does not work with more then one address per each interface.");
+      NS_LOG_WARN ("AODV does not work with more then one address per each interface.");
     }
   Ipv4InterfaceAddress iface = l3->GetAddress (i, 0);
   if (iface.GetLocal () == Ipv4Address ("127.0.0.1"))
@@ -1052,7 +1052,7 @@
   else
     {
       // The forward route for this destination is created if it does not already exist.
-      NS_LOG_LOGIC("add new route");
+      NS_LOG_LOGIC ("add new route");
       m_routingTable.AddRoute (newEntry);
     }
   // Acknowledge receipt of the RREP by sending a RREP-ACK message back
@@ -1174,11 +1174,13 @@
         {
           for (std::map<Ipv4Address, uint32_t>::const_iterator i =
               dstWithNextHopSrc.begin (); i != dstWithNextHopSrc.end (); ++i)
-            if (i->first == un.first)
-              {
-                Ipv4Address dst = un.first;
-                unreachable.insert (un);
-              }
+            {
+              if (i->first == un.first)
+                {
+                  Ipv4Address dst = un.first;
+                  unreachable.insert (un);
+                }
+            }
         }
     }
 
@@ -1276,7 +1278,7 @@
 RoutingProtocol::AckTimerExpire (Ipv4Address neighbor, Time blacklistTimeout)
 {
   NS_LOG_FUNCTION(this);
-  m_routingTable.MarkLinkAsUinidirectional (neighbor, blacklistTimeout);
+  m_routingTable.MarkLinkAsUnidirectional (neighbor, blacklistTimeout);
 }
 
 void
@@ -1450,11 +1452,13 @@
       bool result = true;
       for (std::vector<Ipv4InterfaceAddress>::const_iterator i =
           ifaces.begin (); i != ifaces.end (); ++i)
-        if (*i == toPrecursor.GetInterface ())
-          {
-            result = false;
-            break;
-          }
+        {
+          if (*i == toPrecursor.GetInterface ())
+            {
+              result = false;
+              break;
+            }
+        }
       if (result)
         ifaces.push_back (toPrecursor.GetInterface ());
     }
--- a/src/routing/manet/aodv/aodv-routing-protocol.h	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-routing-protocol.h	Thu Oct 29 11:04:47 2009 +0300
@@ -25,8 +25,8 @@
  * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
  *          Pavel Boyko <boyko@iitp.ru>
  */
-#ifndef AODVROUTINGPROTOCOL_H_
-#define AODVROUTINGPROTOCOL_H_
+#ifndef AODVROUTINGPROTOCOL_H
+#define AODVROUTINGPROTOCOL_H
 
 #include "aodv-rtable.h"
 #include "aodv-rqueue.h"
@@ -246,4 +246,4 @@
 
 }
 }
-#endif /* AODVROUTINGPROTOCOL_H_ */
+#endif /* AODVROUTINGPROTOCOL_H */
--- a/src/routing/manet/aodv/aodv-rqueue.cc	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-rqueue.cc	Thu Oct 29 11:04:47 2009 +0300
@@ -51,10 +51,12 @@
   Purge ();
   for (std::vector<QueueEntry>::const_iterator i = m_queue.begin (); i
       != m_queue.end (); ++i)
-    if ((i->GetPacket ()->GetUid () == entry.GetPacket ()->GetUid ())
-        && (i->GetIpv4Header ().GetDestination ()
-            == entry.GetIpv4Header ().GetDestination ()))
-      return false;
+    {
+      if ((i->GetPacket ()->GetUid () == entry.GetPacket ()->GetUid ())
+          && (i->GetIpv4Header ().GetDestination ()
+              == entry.GetIpv4Header ().GetDestination ()))
+        return false;
+    }
   entry.SetExpireTime (m_queueTimeout);
   if (m_queue.size () == m_maxLen)
     {
@@ -104,8 +106,10 @@
 {
   for (std::vector<QueueEntry>::const_iterator i = m_queue.begin (); i
       != m_queue.end (); ++i)
-    if (i->GetIpv4Header ().GetDestination () == dst)
-      return true;
+    {
+      if (i->GetIpv4Header ().GetDestination () == dst)
+        return true;
+    }
   return false;
 }
 
--- a/src/routing/manet/aodv/aodv-rqueue.h	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-rqueue.h	Thu Oct 29 11:04:47 2009 +0300
@@ -25,8 +25,8 @@
  * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
  *          Pavel Boyko <boyko@iitp.ru>
  */
-#ifndef __aodv_rqueue_h__
-#define __aodv_rqueue_h__
+#ifndef AODV_RQUEUE_H
+#define AODV_RQUEUE_H
 
 #include <vector>
 #include "ns3/ipv4-routing-protocol.h"
@@ -134,4 +134,4 @@
 
 }}
 
-#endif /* __aodv_rqueue_h__ */
+#endif /* AODV_RQUEUE_H */
--- a/src/routing/manet/aodv/aodv-rtable.cc	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-rtable.cc	Thu Oct 29 11:04:47 2009 +0300
@@ -76,8 +76,10 @@
 {
   for (std::vector<Ipv4Address>::const_iterator i = m_precursorList.begin (); i
       != m_precursorList.end (); ++i)
-    if (*i == id)
-      return true;
+    {
+      if (*i == id)
+        return true;
+    }
   return false;
 }
 
@@ -116,8 +118,10 @@
       bool result = true;
       for (std::vector<Ipv4Address>::const_iterator j = prec.begin (); j
           != prec.end (); ++j)
-        if (*j == *i)
-          result = false;
+        {
+          if (*j == *i)
+            result = false;
+        }
       if (result)
         prec.push_back (*i);
     }
@@ -251,11 +255,13 @@
     {
       for (std::map<Ipv4Address, uint32_t>::const_iterator j =
           unreachable.begin (); j != unreachable.end (); ++j)
-        if ((i->first == j->first) && (i->second.GetFlag () == VALID))
-          {
-            NS_LOG_LOGIC ("Invalidate route with destination address " << i->first);
-            i->second.Invalidate (m_badLinkLifetime);
-          }
+        {
+          if ((i->first == j->first) && (i->second.GetFlag () == VALID))
+            {
+              NS_LOG_LOGIC ("Invalidate route with destination address " << i->first);
+              i->second.Invalidate (m_badLinkLifetime);
+            }
+        }
     }
 }
 
@@ -308,7 +314,7 @@
 }
 
 bool
-RoutingTable::MarkLinkAsUinidirectional (Ipv4Address neighbor, Time blacklistTimeout)
+RoutingTable::MarkLinkAsUnidirectional (Ipv4Address neighbor, Time blacklistTimeout)
 {
   std::map<Ipv4Address, RoutingTableEntry>::iterator i =
       m_ipv4AddressEntry.find (neighbor);
--- a/src/routing/manet/aodv/aodv-rtable.h	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-rtable.h	Thu Oct 29 11:04:47 2009 +0300
@@ -25,8 +25,8 @@
  * Authors: Elena Buchatskaia <borovkovaes@iitp.ru>
  *          Pavel Boyko <boyko@iitp.ru>
  */
-#ifndef __aodv_rtable_h__
-#define __aodv_rtable_h__
+#ifndef AODV_RTABLE_H
+#define AODV_RTABLE_H
 
 #include <cassert>
 #include <map>
@@ -236,7 +236,7 @@
    * \param neighbor - neighbor address link to which assumed to be unidirectional
    * \return true on success
    */
-  bool MarkLinkAsUinidirectional(Ipv4Address neighbor, Time blacklistTimeout);
+  bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout);
   /// Print routing table
   void Print(std::ostream &os);
 
@@ -248,4 +248,4 @@
 
 }}
 
-#endif /* _aodv__rtable_h__ */
+#endif /* AODV_RTABLE_H */
--- a/src/routing/manet/aodv/aodv-test-suite.cc	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv-test-suite.cc	Thu Oct 29 11:04:47 2009 +0300
@@ -514,7 +514,7 @@
     NS_TEST_EXPECT_MSG_EQ (rtable.AddRoute (rt4), true, "trivial");
     NS_TEST_EXPECT_MSG_EQ (rtable.SetEntryState (Ipv4Address ("5.5.5.5"), INVALID), true, "trivial");
     NS_TEST_EXPECT_MSG_EQ (rtable.LookupRoute (Ipv4Address ("5.5.5.5"), rt), false, "trivial");
-    NS_TEST_EXPECT_MSG_EQ (rtable.MarkLinkAsUinidirectional (Ipv4Address ("1.2.3.4"), Seconds (2)), true, "trivial");
+    NS_TEST_EXPECT_MSG_EQ (rtable.MarkLinkAsUnidirectional (Ipv4Address ("1.2.3.4"), Seconds (2)), true, "trivial");
     NS_TEST_EXPECT_MSG_EQ (rtable.LookupRoute (Ipv4Address ("1.2.3.4"), rt), true, "trivial");
     NS_TEST_EXPECT_MSG_EQ (rt.IsUnidirectional (), true, "trivial");
     rt.SetLifeTime (Seconds (-5));
--- a/src/routing/manet/aodv/aodv.h	Wed Oct 28 18:29:51 2009 +0300
+++ b/src/routing/manet/aodv/aodv.h	Thu Oct 29 11:04:47 2009 +0300
@@ -26,8 +26,8 @@
  *          Pavel Boyko <boyko@iitp.ru>
  */
 
-#ifndef AODV_H_
-#define AODV_H_
+#ifndef AODV_H
+#define AODV_H
 
 /**
  * \ingroup routing
@@ -80,4 +80,4 @@
    */
  */
 
-#endif /* AODV_H_ */
+#endif /* AODV_H */