Fixed coding style
authorKirill Andreev <andreev@iitp.ru>
Wed, 22 Jul 2009 14:52:42 +0400
changeset 5129 5688b8da4526
parent 5128 d6e168eba404
child 5130 b5062e8e0da1
Fixed coding style
src/devices/mesh/dot11s/airtime-metric.cc
src/devices/mesh/dot11s/airtime-metric.h
src/devices/mesh/dot11s/dot11s-installer.cc
src/devices/mesh/dot11s/dot11s-mac-header.cc
src/devices/mesh/dot11s/dot11s-mac-header.h
src/devices/mesh/dot11s/hwmp-protocol-mac.cc
src/devices/mesh/dot11s/hwmp-protocol-mac.h
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/dot11s/hwmp-tag.cc
src/devices/mesh/dot11s/hwmp-tag.h
src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc
src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h
src/devices/mesh/dot11s/ie-dot11s-configuration.cc
src/devices/mesh/dot11s/ie-dot11s-id.cc
src/devices/mesh/dot11s/ie-dot11s-id.h
src/devices/mesh/dot11s/ie-dot11s-metric-report.cc
src/devices/mesh/dot11s/ie-dot11s-metric-report.h
src/devices/mesh/dot11s/ie-dot11s-peer-management.cc
src/devices/mesh/dot11s/ie-dot11s-peer-management.h
src/devices/mesh/dot11s/ie-dot11s-peering-protocol.cc
src/devices/mesh/dot11s/ie-dot11s-peering-protocol.h
src/devices/mesh/dot11s/ie-dot11s-perr.cc
src/devices/mesh/dot11s/ie-dot11s-perr.h
src/devices/mesh/dot11s/ie-dot11s-prep.cc
src/devices/mesh/dot11s/ie-dot11s-prep.h
src/devices/mesh/dot11s/ie-dot11s-preq.cc
src/devices/mesh/dot11s/ie-dot11s-preq.h
src/devices/mesh/dot11s/ie-dot11s-rann.cc
src/devices/mesh/dot11s/ie-dot11s-rann.h
src/devices/mesh/dot11s/peer-link-frame.cc
src/devices/mesh/dot11s/peer-link-frame.h
src/devices/mesh/dot11s/peer-link.cc
src/devices/mesh/dot11s/peer-link.h
src/devices/mesh/dot11s/peer-management-protocol-mac.cc
src/devices/mesh/dot11s/peer-management-protocol-mac.h
src/devices/mesh/dot11s/peer-management-protocol.cc
src/devices/mesh/dot11s/peer-management-protocol.h
src/devices/mesh/flame/flame-header.cc
src/devices/mesh/flame/flame-header.h
src/devices/mesh/flame/flame-installer.cc
src/devices/mesh/flame/flame-installer.h
src/devices/mesh/flame/flame-protocol-mac.cc
src/devices/mesh/flame/flame-protocol-mac.h
src/devices/mesh/flame/flame-protocol.cc
src/devices/mesh/flame/flame-protocol.h
src/devices/mesh/flame/flame-rtable.cc
src/devices/mesh/flame/flame-rtable.h
src/devices/mesh/mesh-l2-routing-protocol.cc
src/devices/mesh/mesh-l2-routing-protocol.h
src/devices/mesh/mesh-point-device.cc
src/devices/mesh/mesh-point-device.h
src/devices/mesh/mesh-wifi-interface-mac.cc
src/devices/mesh/mesh-wifi-interface-mac.h
--- a/src/devices/mesh/dot11s/airtime-metric.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/airtime-metric.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,15 +14,17 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
 #include "airtime-metric.h"
 #include "ns3/wifi-remote-station-manager.h"
 #include "ns3/wifi-mode.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 NS_OBJECT_ENSURE_REGISTERED (AirtimeLinkMetricCalculator);
 TypeId
 AirtimeLinkMetricCalculator::GetTypeId ()
@@ -30,61 +32,65 @@
   static TypeId tid = TypeId ("ns3::dot11s::AirtimeLinkMetricCalculator")
     .SetParent<Object> ()
     .AddConstructor<AirtimeLinkMetricCalculator> ()
-    .AddAttribute ("overheadNanosec",
-        "Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2* PREAMBLE + 2* ACK",
-        UintegerValue (108000),
-        MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_overheadNanosec),
-        MakeUintegerChecker<uint32_t> (1)
-        )
-    .AddAttribute ("testLengt",
-        "Rate should be estimated using test length.",
-        UintegerValue (1024),
-        MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_testLength),
-        MakeUintegerChecker<uint16_t> (1)
-        )
-    .AddAttribute ("dot11HeaderLengt",
-        "Length of the 802.11 header",
-        UintegerValue (36),
-        MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_headerLength),
-        MakeUintegerChecker<uint16_t> (0)
-        )
-    .AddAttribute ("dot11sHeaderLength",
-        "Length of the mesh header",
-        UintegerValue (6),
-        MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_meshHeaderLength),
-        MakeUintegerChecker<uint16_t> (0)
-        );
+    .AddAttribute ( "overheadNanosec",
+                    "Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2* PREAMBLE + 2* ACK",
+                    UintegerValue (108000),
+                    MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_overheadNanosec),
+                    MakeUintegerChecker<uint32_t> (1)
+                  )
+    .AddAttribute ( "testLengt",
+                    "Rate should be estimated using test length.",
+                     UintegerValue (1024),
+                     MakeUintegerAccessor (
+                         &AirtimeLinkMetricCalculator::m_testLength),
+                     MakeUintegerChecker<uint16_t> (1)
+                  )
+    .AddAttribute ( "dot11HeaderLengt",
+                    "Length of the 802.11 header",
+                    UintegerValue (36),
+                    MakeUintegerAccessor (
+                        &AirtimeLinkMetricCalculator::m_headerLength),
+                    MakeUintegerChecker<uint16_t> (0)
+                  )
+    .AddAttribute ( "dot11sHeaderLength",
+                    "Length of the mesh header",
+                    UintegerValue (6),
+                    MakeUintegerAccessor (
+                        &AirtimeLinkMetricCalculator::m_meshHeaderLength),
+                    MakeUintegerChecker<uint16_t> (0)
+                  )
+                  ;
   return tid;
-} 
+}
 
 uint32_t
-AirtimeLinkMetricCalculator::CalculateMetric(Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac)
+AirtimeLinkMetricCalculator::CalculateMetric (Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac)
 {
   /* Airtime link metric is defined in 11B.10 of 802.11s Draft D3.0 as:
-   * 
-   * airtime = (O + Bt/r)* (1 + average retry counter), where 
-   * o  -- the PHY dependent channel access which includes frame headers, training sequences, 
-   *       access protocol frames, etc. 
-   * bt -- the test packet length in bits (8192 by default), 
+   *
+   * airtime = (O + Bt/r)* (1 + average retry counter), where
+   * o  -- the PHY dependent channel access which includes frame headers, training sequences,
+   *       access protocol frames, etc.
+   * bt -- the test packet length in bits (8192 by default),
    * r  -- the current bitrate of the packet,
-   *  
+   *
    * Final result is expressed in units of 0.01 Time Unit = 10.24 us (as required by 802.11s draft)
    */
-  
-  const double sec2ns = 1e9;   // seconds -> nanoseconds conversion factor
-  const double ns2tu  = 10240; // nanoseconds -> 0.01 TU conversion factor
-  
-  WifiRemoteStation * station = mac->GetStationManager ()->Lookup(peerAddress);
-  NS_ASSERT(station != 0);
-  Ptr<Packet> test_frame = Create<Packet> (m_testLength+ m_headerLength+ m_meshHeaderLength);
-  uint32_t rate = station->GetDataMode(test_frame, m_testLength + m_headerLength + m_meshHeaderLength).GetDataRate ();
-  uint32_t payload_nanosec = (uint32_t) ((double) ((m_testLength + m_meshHeaderLength) * 8 /*octets -> bits*/) * sec2ns / ((double)rate));
-  uint32_t header_nanosec = (uint32_t)(
-      (double) (m_headerLength * 8 /*octets -> bits*/ * sec2ns) / ((double) mac->GetStationManager () -> GetBasicMode (0).GetDataRate ())
-      );
-  uint32_t metric = (uint32_t) (
-      ((double) (payload_nanosec + header_nanosec + m_overheadNanosec)) / ns2tu * (station->GetAvgSlrc () + 1)
-      );
+
+  const double sec2ns = 1e9; // seconds -> nanoseconds conversion factor
+  const double ns2tu = 10240; // nanoseconds -> 0.01 TU conversion factor
+
+  WifiRemoteStation * station = mac->GetStationManager ()->Lookup (peerAddress);
+  NS_ASSERT (station != 0);
+  Ptr<Packet> test_frame = Create<Packet> (m_testLength + m_headerLength + m_meshHeaderLength);
+  uint32_t rate =
+      station->GetDataMode (test_frame, m_testLength + m_headerLength + m_meshHeaderLength).GetDataRate ();
+  uint32_t payload_nanosec = (uint32_t) (
+      (double) ((m_testLength + m_meshHeaderLength) * 8 /*octets -> bits*/) * sec2ns / ((double) rate));
+  uint32_t header_nanosec = (uint32_t) ((double) (m_headerLength * 8 /*octets -> bits*/* sec2ns)
+      / ((double) mac->GetStationManager () -> GetBasicMode (0).GetDataRate ()));
+  uint32_t metric = (uint32_t) (((double) (payload_nanosec + header_nanosec + m_overheadNanosec)) / ns2tu
+      * (station->GetAvgSlrc () + 1));
   return metric;
 }
 } //namespace dot11s
--- a/src/devices/mesh/dot11s/airtime-metric.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/airtime-metric.h	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,29 +14,31 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
 #ifndef AIRTIME_METRIC_H
 #define AIRTIME_METRIC_H
 #include "ns3/mesh-wifi-interface-mac.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief airtime link metric calculator
- * 
+ *
  * \details Airtime link metric is defined in 11B.10 of 802.11s Draft D3.0 as:
- * 
- * airtime = (O + Bt/r)* (1 + average retry counter), where 
- * 
- * o  -- the PHY dependent channel access which includes frame headers, training sequences, 
- *       access protocol frames, etc. 
- * bt -- the test packet length in bits (8192 by default), 
+ *
+ * airtime = (O + Bt/r)* (1 + average retry counter), where
+ *
+ * o  -- the PHY dependent channel access which includes frame headers, training sequences,
+ *       access protocol frames, etc.
+ * bt -- the test packet length in bits (8192 by default),
  * r  -- the current bitrate of the packet,
- *  
+ *
  * Final result is expressed in units of 0.01 Time Unit = 10.24 us (as required by 802.11s draft)
  */
 class AirtimeLinkMetricCalculator : public Object
@@ -45,14 +47,14 @@
     static TypeId GetTypeId ();
     uint32_t CalculateMetric(Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac);
   private:
-    //\brief Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2*PREAMBLE + 2* ACK
-    uint32_t m_overheadNanosec;
-    ///\brief Bt value
-    uint32_t m_testLength;
-    ///\brief header length (used in overhead)
-    uint16_t m_headerLength;
-    ///\brief meshHeader length (6 octets usually)
-    uint16_t m_meshHeaderLength;
+  //\brief Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2*PREAMBLE + 2* ACK
+  uint32_t m_overheadNanosec;
+  ///\brief Bt value
+  uint32_t m_testLength;
+  ///\brief header length (used in overhead)
+  uint16_t m_headerLength;
+  ///\brief meshHeader length (6 octets usually)
+  uint16_t m_meshHeaderLength;
 };
 } //namespace dot11s
 } //namespace ns3
--- a/src/devices/mesh/dot11s/dot11s-installer.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/dot11s-installer.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -22,7 +22,8 @@
 #include "peer-management-protocol.h"
 #include "hwmp-protocol.h"
 
-namespace ns3 {
+namespace ns3
+{
 using namespace dot11s;
 NS_OBJECT_ENSURE_REGISTERED (Dot11sStack);
 TypeId
@@ -30,14 +31,15 @@
 {
   static TypeId tid = TypeId ("ns3::Dot11sStack")
     .SetParent<Object> ()
-    .AddConstructor<Dot11sStack> ()
-    ;
+    .AddConstructor<Dot11sStack> ();
   return tid;
 }
 Dot11sStack::Dot11sStack ()
-{}
+{
+}
 Dot11sStack::~Dot11sStack ()
-{}
+{
+}
 void
 Dot11sStack::DoDispose ()
 {
@@ -45,16 +47,16 @@
 void
 Dot11sStack::SetRoot (Ptr<MeshPointDevice> mp)
 {
-   Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
-   NS_ASSERT(hwmp != 0);
-   hwmp->SetRoot ();
+  Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
+  NS_ASSERT (hwmp != 0);
+  hwmp->SetRoot ();
 }
 bool
 Dot11sStack::InstallStack (Ptr<MeshPointDevice> mp)
 {
   //Install Peer management protocol:
   Ptr<PeerManagementProtocol> pmp = CreateObject<PeerManagementProtocol> ();
-  pmp->SetMeshId("mesh");
+  pmp->SetMeshId ("mesh");
   bool install_ok = pmp->Install (mp);
   if (!install_ok)
     {
@@ -68,27 +70,27 @@
       return false;
     }
   //Install interaction between HWMP and Peer management protocol:
-  pmp->SetPeerLinkStatusCallback (MakeCallback(&HwmpProtocol::PeerLinkStatus, hwmp));
-  hwmp->SetNeighboursCallback (MakeCallback(&PeerManagementProtocol::GetActiveLinks, pmp));
+  pmp->SetPeerLinkStatusCallback (MakeCallback (&HwmpProtocol::PeerLinkStatus, hwmp));
+  hwmp->SetNeighboursCallback (MakeCallback (&PeerManagementProtocol::GetActiveLinks, pmp));
   return true;
 }
 void
 Dot11sStack::Report (const Ptr<MeshPointDevice> mp, std::ostream& os)
 {
   mp->Report (os);
-  
+
   std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
   for (std::vector<Ptr<NetDevice> >::const_iterator i = ifaces.begin (); i != ifaces.end (); ++i)
-  {
-    Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
-    NS_ASSERT (device != 0);
-    MeshInterfaceHelper::Report (device, os);
-  }
-  Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
+    {
+      Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
+      NS_ASSERT (device != 0);
+      MeshInterfaceHelper::Report (device, os);
+    }
+  Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
   NS_ASSERT (hwmp != 0);
   hwmp->Report (os);
 
-  Ptr <PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> ();
+  Ptr<PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> ();
   NS_ASSERT (pmp != 0);
   pmp->Report (os);
 }
@@ -96,20 +98,20 @@
 Dot11sStack::ResetStats (const Ptr<MeshPointDevice> mp)
 {
   mp->ResetStats ();
-  
+
   std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
   for (std::vector<Ptr<NetDevice> >::const_iterator i = ifaces.begin (); i != ifaces.end (); ++i)
-  {
-    Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
-    NS_ASSERT (device != 0);
-    MeshInterfaceHelper::ResetStats (device);
-  }
-  Ptr <HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
-  NS_ASSERT(hwmp != 0);
+    {
+      Ptr<WifiNetDevice> device = (*i)->GetObject<WifiNetDevice> ();
+      NS_ASSERT (device != 0);
+      MeshInterfaceHelper::ResetStats (device);
+    }
+  Ptr<HwmpProtocol> hwmp = mp->GetObject<HwmpProtocol> ();
+  NS_ASSERT (hwmp != 0);
   hwmp->ResetStats ();
 
-  Ptr <PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> ();
-  NS_ASSERT(pmp != 0);
+  Ptr<PeerManagementProtocol> pmp = mp->GetObject<PeerManagementProtocol> ();
+  NS_ASSERT (pmp != 0);
   pmp->ResetStats ();
 }
 } //namespace ns3
--- a/src/devices/mesh/dot11s/dot11s-mac-header.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/dot11s-mac-header.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,15 +18,16 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ns3/assert.h"
 #include "ns3/address-utils.h"
 #include "dot11s-mac-header.h"
 #include "ns3/packet.h"
 #include "ns3/test.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /***********************************************************
  *  Here Mesh Mac Header functionality is defined.
  ***********************************************************/
@@ -34,18 +35,13 @@
 MeshHeader::GetTypeId ()
 {
   static TypeId tid = TypeId ("ns3::Dot11sMacHeader")
-    .SetParent<Header> ()
-    .AddConstructor<MeshHeader> ()
-    ;
+  .SetParent<Header> ()
+  .AddConstructor<MeshHeader> ();
   return tid;
 }
-MeshHeader::MeshHeader ():
-  m_meshFlags (0),
-  m_meshTtl (0),
-  m_meshSeqno (0),
-  m_addr4 (Mac48Address ()),
-  m_addr5 (Mac48Address ()),
-  m_addr6 (Mac48Address ())
+MeshHeader::MeshHeader () :
+  m_meshFlags (0), m_meshTtl (0), m_meshSeqno (0), m_addr4 (Mac48Address ()), m_addr5 (Mac48Address ()),
+      m_addr6 (Mac48Address ())
 {
 }
 MeshHeader::~MeshHeader ()
@@ -170,23 +166,15 @@
 void
 MeshHeader::Print (std::ostream &os) const
 {
-  os << "flags = " << (uint16_t)m_meshFlags
-  << "\nttl = " << (uint16_t)m_meshTtl
-  << "\nseqno = " << m_meshSeqno
-  << "\naddr4 = " << m_addr4
-  << "\naddr5 = " << m_addr5
-  << "\naddr6 = " << m_addr6;
+  os << "flags = " << (uint16_t) m_meshFlags << "\nttl = " << (uint16_t) m_meshTtl << "\nseqno = "
+      << m_meshSeqno << "\naddr4 = " << m_addr4 << "\naddr5 = " << m_addr5 << "\naddr6 = " << m_addr6;
 }
-bool operator== (const MeshHeader & a, const MeshHeader & b)
+bool
+operator== (const MeshHeader & a, const MeshHeader & b)
 {
-  return (
-      (a.m_meshFlags == b.m_meshFlags) &&
-      (a.m_meshTtl == b.m_meshTtl) &&
-      (a.m_meshSeqno == b.m_meshSeqno) &&
-      (a.m_addr4 == b.m_addr4) &&
-      (a.m_addr5 == b.m_addr5) &&
-      (a.m_addr6 == b.m_addr6)
-      );
+  return ((a.m_meshFlags == b.m_meshFlags) && (a.m_meshTtl == b.m_meshTtl)
+      && (a.m_meshSeqno == b.m_meshSeqno) && (a.m_addr4 == b.m_addr4) && (a.m_addr5 == b.m_addr5)
+      && (a.m_addr6 == b.m_addr6));
 }
 /**********************************************************
  *   ActionFrame
@@ -198,29 +186,28 @@
 {
 }
 void
-WifiMeshActionHeader::SetAction (
-  WifiMeshActionHeader::CategoryValue type,
-  WifiMeshActionHeader::ActionValue action)
+WifiMeshActionHeader::SetAction (WifiMeshActionHeader::CategoryValue type,
+    WifiMeshActionHeader::ActionValue action)
 {
   m_category = type;
-  
+
   switch (type)
     {
-    case MESH_PEERING_MGT:
-      {
-        m_actionValue = action.peerLink;
-        break;
-      }
-    case MESH_PATH_SELECTION:
-      {
-        m_actionValue = action.pathSelection;
-        break;
-      }
-    case MESH_LINK_METRIC:
-    case MESH_INTERWORKING:
-    case MESH_RESOURCE_COORDINATION:
-    case MESH_PROXY_FORWARDING:
+  case MESH_PEERING_MGT:
+    {
+      m_actionValue = action.peerLink;
       break;
+    }
+  case MESH_PATH_SELECTION:
+    {
+      m_actionValue = action.pathSelection;
+      break;
+    }
+  case MESH_LINK_METRIC:
+  case MESH_INTERWORKING:
+  case MESH_RESOURCE_COORDINATION:
+  case MESH_PROXY_FORWARDING:
+    break;
     };
 }
 WifiMeshActionHeader::CategoryValue
@@ -228,21 +215,21 @@
 {
   switch (m_category)
     {
-    case MESH_PEERING_MGT:
-      return MESH_PEERING_MGT;
-    case MESH_LINK_METRIC:
-      return MESH_LINK_METRIC;
-    case MESH_PATH_SELECTION:
-      return MESH_PATH_SELECTION;
-    case MESH_INTERWORKING:
-      return MESH_INTERWORKING;
-    case MESH_RESOURCE_COORDINATION:
-      return MESH_RESOURCE_COORDINATION;
-    case MESH_PROXY_FORWARDING:
-      return MESH_PROXY_FORWARDING;
-    default:
-      NS_FATAL_ERROR ("Unknown action value");
-      return MESH_PEERING_MGT;
+  case MESH_PEERING_MGT:
+    return MESH_PEERING_MGT;
+  case MESH_LINK_METRIC:
+    return MESH_LINK_METRIC;
+  case MESH_PATH_SELECTION:
+    return MESH_PATH_SELECTION;
+  case MESH_INTERWORKING:
+    return MESH_INTERWORKING;
+  case MESH_RESOURCE_COORDINATION:
+    return MESH_RESOURCE_COORDINATION;
+  case MESH_PROXY_FORWARDING:
+    return MESH_PROXY_FORWARDING;
+  default:
+    NS_FATAL_ERROR ("Unknown action value");
+    return MESH_PEERING_MGT;
     }
 }
 WifiMeshActionHeader::ActionValue
@@ -251,50 +238,49 @@
   ActionValue retval;
   switch (m_category)
     {
-    case MESH_PEERING_MGT:
-      switch (m_actionValue)
-        {
-        case PEER_LINK_OPEN:
-          retval.peerLink = PEER_LINK_OPEN;
-          return retval;
-        case PEER_LINK_CONFIRM:
-          retval.peerLink = PEER_LINK_CONFIRM;
-          return retval;
-        case PEER_LINK_CLOSE:
-          retval.peerLink = PEER_LINK_CLOSE;
-          return retval;
-        default:
-          NS_FATAL_ERROR ("Unknown mesh peering management action code");
-          return retval;
-        }
-    case MESH_PATH_SELECTION:
-      switch (m_actionValue)
-        {
-        case PATH_SELECTION:
-          retval.pathSelection = PATH_SELECTION;
-          return retval;
-        default:
-          NS_FATAL_ERROR ("Unknown mesh path selection action code");
-          return retval;
-        }
-    case MESH_LINK_METRIC:
-      // not yet supported 
-    case MESH_INTERWORKING:
-      // not yet supported
-    case MESH_RESOURCE_COORDINATION:
-      // not yet supported
+  case MESH_PEERING_MGT:
+    switch (m_actionValue)
+      {
+    case PEER_LINK_OPEN:
+      retval.peerLink = PEER_LINK_OPEN;
+      return retval;
+    case PEER_LINK_CONFIRM:
+      retval.peerLink = PEER_LINK_CONFIRM;
+      return retval;
+    case PEER_LINK_CLOSE:
+      retval.peerLink = PEER_LINK_CLOSE;
+      return retval;
     default:
-      NS_FATAL_ERROR ("Unsupported mesh action");
+      NS_FATAL_ERROR ("Unknown mesh peering management action code");
+      return retval;
+      }
+  case MESH_PATH_SELECTION:
+    switch (m_actionValue)
+      {
+    case PATH_SELECTION:
+      retval.pathSelection = PATH_SELECTION;
       return retval;
+    default:
+      NS_FATAL_ERROR ("Unknown mesh path selection action code");
+      return retval;
+      }
+  case MESH_LINK_METRIC:
+    // not yet supported
+  case MESH_INTERWORKING:
+    // not yet supported
+  case MESH_RESOURCE_COORDINATION:
+    // not yet supported
+  default:
+    NS_FATAL_ERROR ("Unsupported mesh action");
+    return retval;
     }
 }
 TypeId
 WifiMeshActionHeader::GetTypeId ()
 {
   static TypeId tid = TypeId ("ns3::WifiMeshActionHeader")
-                      .SetParent<Header> ()
-                      .AddConstructor<WifiMeshActionHeader> ()
-                      ;
+  .SetParent<Header> ()
+  .AddConstructor<WifiMeshActionHeader> ();
   return tid;
 }
 TypeId
@@ -328,57 +314,62 @@
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for Dot11sMacHeader
-struct Dot11sMacHeaderBist : public Test 
+struct Dot11sMacHeaderBist : public Test
 {
-  Dot11sMacHeaderBist () : Test ("Mesh/802.11s/MeshHeader") {}
-  virtual bool RunTests (); 
+  Dot11sMacHeaderBist () :
+    Test ("Mesh/802.11s/MeshHeader")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static Dot11sMacHeaderBist g_Dot11sMacHeaderBist;
 
-bool Dot11sMacHeaderBist::RunTests ()
+bool
+Dot11sMacHeaderBist::RunTests ()
 {
   bool result (true);
-  {
-    MeshHeader a;
-    a.SetAddressExt (3);
-    a.SetAddr4 (Mac48Address ("11:22:33:44:55:66"));
-    a.SetAddr5 (Mac48Address ("11:00:33:00:55:00"));
-    a.SetAddr6 (Mac48Address ("00:22:00:44:00:66"));
-    a.SetMeshTtl (122);
-    a.SetMeshSeqno (321);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    MeshHeader b;
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (a, b);
-  } 
-  {
-    MeshHeader a;
-    a.SetAddressExt (2);
-    a.SetAddr5 (Mac48Address ("11:00:33:00:55:00"));
-    a.SetAddr6 (Mac48Address ("00:22:00:44:00:66"));
-    a.SetMeshTtl (122);
-    a.SetMeshSeqno (321);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    MeshHeader b;
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (a, b);
-  }
-  {
-    MeshHeader a;
-    a.SetAddressExt (1);
-    a.SetAddr4 (Mac48Address ("11:22:33:44:55:66"));
-    a.SetMeshTtl (122);
-    a.SetMeshSeqno (321);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    MeshHeader b;
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (a, b);
-  }
+    {
+      MeshHeader a;
+      a.SetAddressExt (3);
+      a.SetAddr4 (Mac48Address ("11:22:33:44:55:66"));
+      a.SetAddr5 (Mac48Address ("11:00:33:00:55:00"));
+      a.SetAddr6 (Mac48Address ("00:22:00:44:00:66"));
+      a.SetMeshTtl (122);
+      a.SetMeshSeqno (321);
+      Ptr<Packet> packet = Create<Packet> ();
+      packet->AddHeader (a);
+      MeshHeader b;
+      packet->RemoveHeader (b);
+      NS_TEST_ASSERT_EQUAL (a, b);
+    }
+    {
+      MeshHeader a;
+      a.SetAddressExt (2);
+      a.SetAddr5 (Mac48Address ("11:00:33:00:55:00"));
+      a.SetAddr6 (Mac48Address ("00:22:00:44:00:66"));
+      a.SetMeshTtl (122);
+      a.SetMeshSeqno (321);
+      Ptr<Packet> packet = Create<Packet> ();
+      packet->AddHeader (a);
+      MeshHeader b;
+      packet->RemoveHeader (b);
+      NS_TEST_ASSERT_EQUAL (a, b);
+    }
+    {
+      MeshHeader a;
+      a.SetAddressExt (1);
+      a.SetAddr4 (Mac48Address ("11:22:33:44:55:66"));
+      a.SetMeshTtl (122);
+      a.SetMeshSeqno (321);
+      Ptr<Packet> packet = Create<Packet> ();
+      packet->AddHeader (a);
+      MeshHeader b;
+      packet->RemoveHeader (b);
+      NS_TEST_ASSERT_EQUAL (a, b);
+    }
   return result;
 }
 #endif
--- a/src/devices/mesh/dot11s/dot11s-mac-header.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/dot11s-mac-header.h	Wed Jul 22 14:52:42 2009 +0400
@@ -29,10 +29,10 @@
 namespace dot11s {
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief Mesh Control field, see IEEE 802.11s draft 3.0 section 7.1.3.5b
- * 
- * Header format: | Mesh flags: 1 | TTL: 1 | Sequence number: 4 | Address ext.: 0, 6, 12 or 18 | 
+ *
+ * Header format: | Mesh flags: 1 | TTL: 1 | Sequence number: 4 | Address ext.: 0, 6, 12 or 18 |
  */
 class MeshHeader : public Header
 {
@@ -43,28 +43,28 @@
   virtual TypeId GetInstanceTypeId () const;
   virtual void Print (std::ostream &os) const;
 
-  void   SetAddr4 (Mac48Address address);
-  void   SetAddr5 (Mac48Address address);
-  void   SetAddr6 (Mac48Address address);
-  Mac48Address  GetAddr4 () const;
-  Mac48Address  GetAddr5 () const;
-  Mac48Address  GetAddr6 () const;
+  void SetAddr4 (Mac48Address address);
+  void SetAddr5 (Mac48Address address);
+  void SetAddr6 (Mac48Address address);
+  Mac48Address GetAddr4 () const;
+  Mac48Address GetAddr5 () const;
+  Mac48Address GetAddr6 () const;
 
-  void   SetMeshSeqno (uint32_t seqno);
-  uint32_t  GetMeshSeqno () const;
+  void SetMeshSeqno (uint32_t seqno);
+  uint32_t GetMeshSeqno () const;
 
-  void   SetMeshTtl (uint8_t TTL);
-  uint8_t  GetMeshTtl () const;
+  void SetMeshTtl (uint8_t TTL);
+  uint8_t GetMeshTtl () const;
 
-  void   SetAddressExt (uint8_t num_of_addresses);
-  uint8_t  GetAddressExt () const;
+  void SetAddressExt (uint8_t num_of_addresses);
+  uint8_t GetAddressExt () const;
 
   virtual uint32_t GetSerializedSize () const;
-  virtual void  Serialize (Buffer::Iterator start) const;
+  virtual void Serialize (Buffer::Iterator start) const;
   virtual uint32_t Deserialize (Buffer::Iterator start);
 private:
-  uint8_t  m_meshFlags;
-  uint8_t  m_meshTtl;
+  uint8_t m_meshFlags;
+  uint8_t m_meshTtl;
   uint32_t m_meshSeqno;
   Mac48Address m_addr4;
   Mac48Address m_addr5;
@@ -75,37 +75,37 @@
 
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief See IEEE 802.11s draft 3.0 section 7.2.3.14
- * 
- * Header format: | category: 1 | action value: 1 | 
+ *
+ * Header format: | category: 1 | action value: 1 |
  */
-class WifiMeshActionHeader : public Header 
+class WifiMeshActionHeader : public Header
 {
 public:
   WifiMeshActionHeader ();
   ~WifiMeshActionHeader ();
-      
+
   /* Compatible with open80211s implementation */
   enum CategoryValue //table 7-24 staring from 4
   {
-    MESH_PEERING_MGT            = 30,
-    MESH_LINK_METRIC            = 31,
-    MESH_PATH_SELECTION         = 32,
-    MESH_INTERWORKING           = 33,
-    MESH_RESOURCE_COORDINATION  = 34,
-    MESH_PROXY_FORWARDING       = 35,
+    MESH_PEERING_MGT = 30,
+    MESH_LINK_METRIC = 31,
+    MESH_PATH_SELECTION = 32,
+    MESH_INTERWORKING = 33,
+    MESH_RESOURCE_COORDINATION = 34,
+    MESH_PROXY_FORWARDING = 35,
   };
   /* Compatible with open80211s implementation */
   enum PeerLinkMgtActionValue
   {
-    PEER_LINK_OPEN              = 0,
-    PEER_LINK_CONFIRM           = 1,
-    PEER_LINK_CLOSE             = 2,
+    PEER_LINK_OPEN = 0,
+    PEER_LINK_CONFIRM = 1,
+    PEER_LINK_CLOSE = 2,
   };
   enum LinkMetricActionValue
   {
-    LINK_METRIC_REQUEST         = 0,
+    LINK_METRIC_REQUEST = 0,
     LINK_METRIC_REPORT,
   };
   /* Compatible with open80211s implementation */
@@ -115,7 +115,7 @@
   };
   enum InterworkActionValue
   {
-    PORTAL_ANNOUNCEMENT         = 0,
+    PORTAL_ANNOUNCEMENT = 0,
   };
   enum ResourceCoordinationActionValue
   {
@@ -132,21 +132,21 @@
   };
   typedef union
   {
-    enum PeerLinkMgtActionValue  peerLink;
-    enum LinkMetricActionValue  linkMetrtic;
-    enum PathSelectionActionValue  pathSelection;
-    enum InterworkActionValue  interwork;
+    enum PeerLinkMgtActionValue peerLink;
+    enum LinkMetricActionValue linkMetrtic;
+    enum PathSelectionActionValue pathSelection;
+    enum InterworkActionValue interwork;
     enum ResourceCoordinationActionValue resourceCoordination;
   } ActionValue;
   void   SetAction (enum CategoryValue type,ActionValue action);
-  
+
   CategoryValue GetCategory ();
-  ActionValue  GetAction ();
-  static TypeId  GetTypeId ();
-  virtual TypeId  GetInstanceTypeId () const;
-  virtual void  Print (std::ostream &os) const;
+  ActionValue GetAction ();
+  static TypeId GetTypeId ();
+  virtual TypeId GetInstanceTypeId () const;
+  virtual void Print (std::ostream &os) const;
   virtual uint32_t GetSerializedSize () const;
-  virtual void  Serialize (Buffer::Iterator start) const;
+  virtual void Serialize (Buffer::Iterator start) const;
   virtual uint32_t Deserialize (Buffer::Iterator start);
 private:
   uint8_t m_category;
--- a/src/devices/mesh/dot11s/hwmp-protocol-mac.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol-mac.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -31,13 +31,14 @@
 #include "ie-dot11s-prep.h"
 #include "ie-dot11s-rann.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
 NS_LOG_COMPONENT_DEFINE ("HwmpProtocolMac");
-HwmpProtocolMac::HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol):
-  m_ifIndex (ifIndex),
-  m_protocol (protocol)
+HwmpProtocolMac::HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol) :
+  m_ifIndex (ifIndex), m_protocol (protocol)
 {
 }
 HwmpProtocolMac::~HwmpProtocolMac ()
@@ -52,46 +53,48 @@
 bool
 HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header)
 {
-  NS_ASSERT (header.IsData());
+  NS_ASSERT (header.IsData ());
 
   MeshHeader meshHdr;
   HwmpTag tag;
   if (packet->PeekPacketTag (tag))
-  {
-    NS_FATAL_ERROR ("HWMP tag is not supposed to be received by network");
-  }
-  
+    {
+      NS_FATAL_ERROR ("HWMP tag is not supposed to be received by network");
+    }
+
   packet->RemoveHeader (meshHdr);
-  m_stats.rxData ++;
+  m_stats.rxData++;
   m_stats.rxDataBytes += packet->GetSize ();
-  
+
   //TODO: address extension
   Mac48Address destination;
   Mac48Address source;
   switch (meshHdr.GetAddressExt ())
-  {
-    case 0:
-      source = header.GetAddr4 ();
-      destination = header.GetAddr3 ();
-      break;
-    default:
-      NS_FATAL_ERROR ("6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
-  };
+    {
+  case 0:
+    source = header.GetAddr4 ();
+    destination = header.GetAddr3 ();
+    break;
+  default:
+    NS_FATAL_ERROR (
+        "6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
+    };
   tag.SetSeqno (meshHdr.GetMeshSeqno ());
   tag.SetTtl (meshHdr.GetMeshTtl ());
   packet->AddPacketTag (tag);
- 
-  if ((destination == Mac48Address::GetBroadcast ()) && (m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (), source)))
+
+  if ((destination == Mac48Address::GetBroadcast ()) && (m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (),
+      source)))
     {
       return false;
-    } 
+    }
   return true;
 }
 
 bool
 HwmpProtocolMac::ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header)
 {
-  m_stats.rxMgt ++;
+  m_stats.rxMgt++;
   m_stats.rxMgtBytes += packet->GetSize ();
   WifiMeshActionHeader actionHdr;
   packet->RemoveHeader (actionHdr);
@@ -105,46 +108,49 @@
   IePrep prep;
   IePerr perr;
   while (packet->RemoveHeader (rann))
-  {
-    NS_LOG_WARN("RANN is not supported!");
-  }
+    {
+      NS_LOG_WARN ("RANN is not supported!");
+    }
   while (packet->RemoveHeader (preq))
-  {
-    m_stats.rxPreq ++;
-    if (preq.GetOriginatorAddress () == m_protocol->GetAddress ())
-      {
-        continue;
-      }
-    if (preq.GetTtl () == 0)
-      {
-        continue;
-      }
-    preq.DecrementTtl ();
-    m_protocol->ReceivePreq (preq, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (), m_parent->GetLinkMetric(header.GetAddr2 ()));
-  }
+    {
+      m_stats.rxPreq++;
+      if (preq.GetOriginatorAddress () == m_protocol->GetAddress ())
+        {
+          continue;
+        }
+      if (preq.GetTtl () == 0)
+        {
+          continue;
+        }
+      preq.DecrementTtl ();
+      m_protocol->ReceivePreq (preq, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (),
+          m_parent->GetLinkMetric (header.GetAddr2 ()));
+    }
   while (packet->RemoveHeader (prep))
-  {
-    m_stats.rxPrep ++;
-    if (prep.GetTtl () == 0)
-      {
-        continue;
-      }
-    prep.DecrementTtl ();
-    m_protocol->ReceivePrep (prep, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (), m_parent->GetLinkMetric(header.GetAddr2 ()));
-  }
+    {
+      m_stats.rxPrep++;
+      if (prep.GetTtl () == 0)
+        {
+          continue;
+        }
+      prep.DecrementTtl ();
+      m_protocol->ReceivePrep (prep, header.GetAddr2 (), m_ifIndex, header.GetAddr3 (),
+          m_parent->GetLinkMetric (header.GetAddr2 ()));
+    }
   std::vector<IePerr::FailedDestination> failedDestinations;
   while (packet->RemoveHeader (perr))
-  {
-    m_stats.rxPerr ++;
-    std::vector<IePerr::FailedDestination> destinations = perr.GetAddressUnitVector ();
-    for(std::vector<IePerr::FailedDestination>::const_iterator i = destinations.begin (); i != destinations.end (); i ++)
-      failedDestinations.push_back (*i);
-  }
+    {
+      m_stats.rxPerr++;
+      std::vector<IePerr::FailedDestination> destinations = perr.GetAddressUnitVector ();
+      for (std::vector<IePerr::FailedDestination>::const_iterator i = destinations.begin (); i
+          != destinations.end (); i++)
+        failedDestinations.push_back (*i);
+    }
   if (failedDestinations.size () > 0)
     {
       m_protocol->ReceivePerr (failedDestinations, header.GetAddr2 (), m_ifIndex, header.GetAddr3 ());
     }
-  NS_ASSERT(packet->GetSize () == 0);
+  NS_ASSERT (packet->GetSize () == 0);
   return false;
 }
 
@@ -155,7 +161,7 @@
     {
       return ReceiveData (packet, header);
     }
-  else 
+  else
     {
       if (header.IsAction ())
         {
@@ -168,25 +174,26 @@
     }
 }
 bool
-HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to)
+HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from,
+    Mac48Address to)
 {
   if (!header.IsData ())
     {
       return true;
     }
   HwmpTag tag;
-  bool tagExists = packet->RemovePacketTag(tag);
+  bool tagExists = packet->RemovePacketTag (tag);
   if (!tagExists)
-  {
-    NS_FATAL_ERROR ("HWMP tag must exist at this point");
-  }
-  m_stats.txData ++;
+    {
+      NS_FATAL_ERROR ("HWMP tag must exist at this point");
+    }
+  m_stats.txData++;
   m_stats.txDataBytes += packet->GetSize ();
   MeshHeader meshHdr;
   meshHdr.SetMeshSeqno (tag.GetSeqno ());
-  meshHdr.SetMeshTtl (tag.GetTtl());
+  meshHdr.SetMeshTtl (tag.GetTtl ());
   packet->AddHeader (meshHdr);
-  header.SetAddr1 (tag.GetAddress());
+  header.SetAddr1 (tag.GetAddress ());
   return true;
 }
 WifiMeshActionHeader
@@ -203,17 +210,17 @@
 {
   NS_LOG_FUNCTION_NOARGS ();
   std::vector<IePreq> preq_vector;
-  preq_vector.push_back(preq);
-  SendPreq(preq_vector);
+  preq_vector.push_back (preq);
+  SendPreq (preq_vector);
 }
 void
-HwmpProtocolMac::SendPreq(std::vector<IePreq> preq)
+HwmpProtocolMac::SendPreq (std::vector<IePreq> preq)
 {
   Ptr<Packet> packet = Create<Packet> ();
-  for(std::vector<IePreq>::const_iterator i = preq.begin (); i != preq.end (); i ++)
-  {
-    packet->AddHeader (*i);
-  }
+  for (std::vector<IePreq>::const_iterator i = preq.begin (); i != preq.end (); i++)
+    {
+      packet->AddHeader (*i);
+    }
   packet->AddHeader (GetWifiMeshActionHeader ());
   //create 802.11 header:
   WifiMacHeader hdr;
@@ -223,29 +230,29 @@
   hdr.SetAddr2 (m_parent->GetAddress ());
   hdr.SetAddr3 (m_protocol->GetAddress ());
   //Send Management frame
-  std::vector <Mac48Address> receivers = m_protocol->GetPreqReceivers (m_ifIndex);
-  for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i ++)
-  {
-    hdr.SetAddr1 (*i);
-    m_stats.txPreq ++;
-    m_stats.txMgt ++;
-    m_stats.txMgtBytes += packet->GetSize ();
-    m_parent->SendManagementFrame (packet, hdr);
-  }
+  std::vector<Mac48Address> receivers = m_protocol->GetPreqReceivers (m_ifIndex);
+  for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
+    {
+      hdr.SetAddr1 (*i);
+      m_stats.txPreq++;
+      m_stats.txMgt++;
+      m_stats.txMgtBytes += packet->GetSize ();
+      m_parent->SendManagementFrame (packet, hdr);
+    }
 }
 void
 HwmpProtocolMac::RequestDestination (Mac48Address dst, uint32_t originator_seqno, uint32_t dst_seqno)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  for (std::vector<IePreq>::iterator i = m_myPreq.begin (); i != m_myPreq.end(); i ++)
-  {
-    if (i->IsFull ())
-      {
-        continue;
-      }
-    NS_ASSERT (i->GetDestCount () > 0);
-    i->AddDestinationAddressElement (m_protocol->GetDoFlag(), m_protocol->GetRfFlag(), dst, dst_seqno);
-  }
+  for (std::vector<IePreq>::iterator i = m_myPreq.begin (); i != m_myPreq.end (); i++)
+    {
+      if (i->IsFull ())
+        {
+          continue;
+        }
+      NS_ASSERT (i->GetDestCount () > 0);
+      i->AddDestinationAddressElement (m_protocol->GetDoFlag (), m_protocol->GetRfFlag (), dst, dst_seqno);
+    }
   IePreq preq;
   preq.SetHopcount (0);
   preq.SetTTL (m_protocol->GetMaxTtl ());
@@ -253,8 +260,8 @@
   preq.SetOriginatorAddress (m_protocol->GetAddress ());
   preq.SetOriginatorSeqNumber (originator_seqno);
   preq.SetLifetime (m_protocol->GetActivePathLifetime ());
-  preq.AddDestinationAddressElement (m_protocol->GetDoFlag(), m_protocol->GetRfFlag(), dst, dst_seqno);
-  m_myPreq.push_back(preq);
+  preq.AddDestinationAddressElement (m_protocol->GetDoFlag (), m_protocol->GetRfFlag (), dst, dst_seqno);
+  m_myPreq.push_back (preq);
   SendMyPreq ();
 }
 void
@@ -270,7 +277,7 @@
       return;
     }
   //reschedule sending PREQ
-  NS_ASSERT (!m_preqTimer.IsRunning());
+  NS_ASSERT (!m_preqTimer.IsRunning ());
   m_preqTimer = Simulator::Schedule (m_protocol->GetPreqMinInterval (), &HwmpProtocolMac::SendMyPreq, this);
   SendPreq (m_myPreq);
   m_myPreq.clear ();
@@ -280,7 +287,7 @@
 {
   NS_LOG_FUNCTION_NOARGS ();
   //Create packet
-  Ptr<Packet> packet  = Create<Packet> ();
+  Ptr<Packet> packet = Create<Packet> ();
   packet->AddHeader (prep);
   packet->AddHeader (GetWifiMeshActionHeader ());
   //create 802.11 header:
@@ -292,29 +299,31 @@
   hdr.SetAddr2 (m_parent->GetAddress ());
   hdr.SetAddr3 (m_protocol->GetAddress ());
   //Send Management frame
-  m_stats.txPrep ++;
-  m_stats.txMgt ++;
+  m_stats.txPrep++;
+  m_stats.txMgt++;
   m_stats.txMgtBytes += packet->GetSize ();
-  m_parent->SendManagementFrame(packet, hdr);
+  m_parent->SendManagementFrame (packet, hdr);
 }
 void
-HwmpProtocolMac::ForwardPerr(std::vector<IePerr::FailedDestination> failedDestinations, std::vector<Mac48Address> receivers)
+HwmpProtocolMac::ForwardPerr (std::vector<IePerr::FailedDestination> failedDestinations, std::vector<
+    Mac48Address> receivers)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  Ptr<Packet> packet  = Create<Packet> ();
+  Ptr<Packet> packet = Create<Packet> ();
   IePerr perr;
-  for (std::vector<IePerr::FailedDestination>::const_iterator i = failedDestinations.begin (); i != failedDestinations.end (); i ++)
-  {
-    if (!perr.IsFull ())
-      {
-        perr.AddAddressUnit (*i);
-      }
-    else
-      {
-        packet->AddHeader (perr);
-        perr.ResetPerr ();
-      }
-  }
+  for (std::vector<IePerr::FailedDestination>::const_iterator i = failedDestinations.begin (); i
+      != failedDestinations.end (); i++)
+    {
+      if (!perr.IsFull ())
+        {
+          perr.AddAddressUnit (*i);
+        }
+      else
+        {
+          packet->AddHeader (perr);
+          perr.ResetPerr ();
+        }
+    }
   if (perr.GetNumOfDest () > 0)
     {
       packet->AddHeader (perr);
@@ -327,66 +336,70 @@
   hdr.SetDsNotTo ();
   hdr.SetAddr2 (m_parent->GetAddress ());
   hdr.SetAddr3 (m_protocol->GetAddress ());
-  if(receivers.size () >= m_protocol->GetUnicastPerrThreshold ())
-  {
-    receivers.clear ();
-    receivers.push_back (Mac48Address::GetBroadcast ());
-  }
+  if (receivers.size () >= m_protocol->GetUnicastPerrThreshold ())
+    {
+      receivers.clear ();
+      receivers.push_back (Mac48Address::GetBroadcast ());
+    }
   //Send Management frame
-  for (std::vector<Mac48Address>::const_iterator i = m_myPerr.receivers.begin (); i != m_myPerr.receivers.end (); i ++)
-  {
-    hdr.SetAddr1 (*i);
-    m_stats.txPerr ++;
-    m_stats.txMgt ++;
-    m_stats.txMgtBytes += packet->GetSize ();
-    m_parent->SendManagementFrame(packet, hdr);
-  }
+  for (std::vector<Mac48Address>::const_iterator i = m_myPerr.receivers.begin (); i
+      != m_myPerr.receivers.end (); i++)
+    {
+      hdr.SetAddr1 (*i);
+      m_stats.txPerr++;
+      m_stats.txMgt++;
+      m_stats.txMgtBytes += packet->GetSize ();
+      m_parent->SendManagementFrame (packet, hdr);
+    }
 }
 void
-HwmpProtocolMac::InitiatePerr (std::vector<IePerr::FailedDestination> failedDestinations, std::vector<Mac48Address> receivers)
+HwmpProtocolMac::InitiatePerr (std::vector<IePerr::FailedDestination> failedDestinations, std::vector<
+    Mac48Address> receivers)
 {
   //All duplicates in PERR are checked here, and there is no reason to
   //check it at any athoer place
-{
-  std::vector<Mac48Address>::const_iterator end = receivers.end();
-  for(std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != end; i ++)
     {
-      bool should_add = true;
-      for (std::vector<Mac48Address>::const_iterator j = m_myPerr.receivers.begin (); j != m_myPerr.receivers.end (); j ++)
-      {
-        if ((*i) == (*j))
+      std::vector<Mac48Address>::const_iterator end = receivers.end ();
+      for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != end; i++)
         {
-          should_add = false;
-        }
-      }
-      if (should_add)
-      {
-        m_myPerr.receivers.push_back(*i);
-      }
-    }
-}
-{
-  std::vector<IePerr::FailedDestination>::const_iterator end =  failedDestinations.end ();
-  for(std::vector<IePerr::FailedDestination>::const_iterator i = failedDestinations.begin (); i != end; i ++)
-    {
-      bool should_add = true;
-      for (std::vector<IePerr::FailedDestination>::const_iterator j = m_myPerr.destinations.begin (); j != m_myPerr.destinations.end (); j ++)
-        {
-          if ( ((*i).destination == (*j).destination) && ((*j).seqnum > (*i).seqnum) )
+          bool should_add = true;
+          for (std::vector<Mac48Address>::const_iterator j = m_myPerr.receivers.begin (); j
+              != m_myPerr.receivers.end (); j++)
             {
-              should_add = false;
+              if ((*i) == (*j))
+                {
+                  should_add = false;
+                }
+            }
+          if (should_add)
+            {
+              m_myPerr.receivers.push_back (*i);
             }
         }
-      if (should_add)
+    }
+    {
+      std::vector<IePerr::FailedDestination>::const_iterator end = failedDestinations.end ();
+      for (std::vector<IePerr::FailedDestination>::const_iterator i = failedDestinations.begin (); i != end; i++)
         {
-          m_myPerr.destinations.push_back(*i);
+          bool should_add = true;
+          for (std::vector<IePerr::FailedDestination>::const_iterator j = m_myPerr.destinations.begin (); j
+              != m_myPerr.destinations.end (); j++)
+            {
+              if (((*i).destination == (*j).destination) && ((*j).seqnum > (*i).seqnum))
+                {
+                  should_add = false;
+                }
+            }
+          if (should_add)
+            {
+              m_myPerr.destinations.push_back (*i);
+            }
         }
     }
-}
   SendMyPerr ();
 }
 void
-HwmpProtocolMac::SendMyPerr()
+HwmpProtocolMac::SendMyPerr ()
 {
   NS_LOG_FUNCTION_NOARGS ();
   if (m_perrTimer.IsRunning ())
@@ -399,7 +412,7 @@
   m_myPerr.receivers.clear ();
 }
 uint32_t
-HwmpProtocolMac::GetLinkMetric(Mac48Address peerAddress) const
+HwmpProtocolMac::GetLinkMetric (Mac48Address peerAddress) const
 {
   return m_parent->GetLinkMetric (peerAddress);
 }
@@ -409,21 +422,10 @@
   return m_parent->GetFrequencyChannel ();
 }
 HwmpProtocolMac::Statistics::Statistics () :
-  txPreq (0), 
-  rxPreq (0),
-  txPrep (0),
-  rxPrep (0),
-  txPerr (0),
-  rxPerr (0),
-  txMgt (0),
-  txMgtBytes (0),
-  rxMgt (0),
-  rxMgtBytes (0),
-  txData (0),
-  txDataBytes (0),
-  rxData (0),
-  rxDataBytes (0)
-{}
+  txPreq (0), rxPreq (0), txPrep (0), rxPrep (0), txPerr (0), rxPerr (0), txMgt (0), txMgtBytes (0),
+      rxMgt (0), rxMgtBytes (0), txData (0), txDataBytes (0), rxData (0), rxDataBytes (0)
+{
+}
 void
 HwmpProtocolMac::Statistics::Print (std::ostream & os) const
 {
@@ -435,7 +437,7 @@
     "rxPrep=\"" << rxPrep << "\"\n"
     "rxPerr=\"" << rxPerr << "\"\n"
     "txMgt=\"" << txMgt << "\"\n"
-    "txMgtBytes=\"" << txMgtBytes  << "\"\n"
+    "txMgtBytes=\"" << txMgtBytes << "\"\n"
     "rxMgt=\"" << rxMgt << "\"\n"
     "rxMgtBytes=\"" << rxMgtBytes << "\"\n"
     "txData=\"" << txData << "\"\n"
@@ -447,8 +449,8 @@
 HwmpProtocolMac::Report (std::ostream & os) const
 {
   os << "<HwmpProtocolMac\n"
-    "address =\""<< m_parent->GetAddress () <<"\">\n";
-  m_stats.Print(os);
+    "address =\"" << m_parent->GetAddress () << "\">\n";
+  m_stats.Print (os);
   os << "</HwmpProtocolMac>\n";
 }
 void
--- a/src/devices/mesh/dot11s/hwmp-protocol-mac.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol-mac.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef HWMP_STATE_H
 #define HWMP_STATE_H
 
@@ -26,11 +25,13 @@
 #include "ie-dot11s-preq.h"
 #include "ie-dot11s-perr.h"
 
-namespace ns3 {
+namespace ns3
+{
 
 class MeshWifiInterfaceMac;
 
-namespace dot11s {
+namespace dot11s
+{
 
 class HwmpProtocol;
 class WifiMeshActionHeader;
@@ -40,7 +41,7 @@
 
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief Interface MAC plugin for HWMP -- 802.11s routing protocol
  */
 class HwmpProtocolMac : public MeshWifiInterfaceMacPlugin
@@ -56,7 +57,7 @@
   /// Update beacon is empty, because HWMP does not know anything about beacons
   void UpdateBeacon (MeshWifiBeacon & beacon) const {};
   //\}
-  
+
 private:
   friend class HwmpProtocol;
   ///\returns a path selection action header
@@ -78,7 +79,7 @@
    */
   void RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno);
   //\}
-  
+
   /// Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
   void SendMyPreq ();
   void SendMyPerr ();
@@ -93,7 +94,7 @@
   Ptr<MeshWifiInterfaceMac> m_parent;
   uint32_t m_ifIndex;
   Ptr<HwmpProtocol> m_protocol;
-  
+
   ///\name my PREQ and PREQ timer:
   //\{
   EventId m_preqTimer;
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "hwmp-protocol.h"
 #include "hwmp-protocol-mac.h"
 #include "hwmp-tag.h"
@@ -37,8 +36,10 @@
 
 NS_LOG_COMPONENT_DEFINE ("HwmpProtocol");
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
 NS_OBJECT_ENSURE_REGISTERED (HwmpProtocol);
 TypeId
@@ -47,128 +48,148 @@
   static TypeId tid = TypeId ("ns3::dot11s::HwmpProtocol")
     .SetParent<MeshL2RoutingProtocol> ()
     .AddConstructor<HwmpProtocol> ()
-    .AddAttribute ("RandomStart", "Random delay at first proactive PREQ",
-        TimeValue (Seconds (0.1)),
-        MakeTimeAccessor (&HwmpProtocol::m_randomStart),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("maxQueueSize",
-        "Maximum number of packets we can store when resolving route",
-        UintegerValue (255),
-        MakeUintegerAccessor (&HwmpProtocol::m_maxQueueSize),
-        MakeUintegerChecker<uint16_t> (1)
-        )
-    .AddAttribute ("dot11MeshHWMPmaxPREQretries",
-        "Maximum number of retries before we suppose the destination to be unreachable",
-        UintegerValue (3),
-        MakeUintegerAccessor (&HwmpProtocol::m_dot11MeshHWMPmaxPREQretries),
-        MakeUintegerChecker<uint8_t> (1)
-        )
-    .AddAttribute ("dot11MeshHWMPnetDiameterTraversalTime",
-        "Time we suppose the packet to go from one edge of the network to another",
-        TimeValue (MicroSeconds (1024*100)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPnetDiameterTraversalTime),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("dot11MeshHWMPpreqMinInterval",
-        "Minimal interval between to successive PREQs",
-        TimeValue (MicroSeconds (1024*100)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPpreqMinInterval),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("dot11MeshHWMPperrMinInterval",
-        "Minimal interval between to successive PREQs",
-        TimeValue (MicroSeconds (1024*100)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPperrMinInterval),
-        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)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPactivePathTimeout),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("dot11MeshHWMPpathToRootInterval",
-        "Interval between two successive proactive PREQs",
-        TimeValue (MicroSeconds (1024*2000)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPpathToRootInterval),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("dot11MeshHWMPrannInterval",
-        "Lifetime of poractive routing information",
-        TimeValue (MicroSeconds (1024*5000)),
-        MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPrannInterval),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("maxTtl",
-        "Initial value of Time To Live field",
-        UintegerValue (32),
-        MakeUintegerAccessor (&HwmpProtocol::m_maxTtl),
-        MakeUintegerChecker<uint8_t> (2)
-        )
-    .AddAttribute ("unicastPerrThreshold",
-        "Maximum number of PERR receivers, when we send a PERR as a chain of unicasts",
-        UintegerValue (32),
-        MakeUintegerAccessor (&HwmpProtocol::m_unicastPerrThreshold),
-        MakeUintegerChecker<uint8_t> (1)
-        )
-    .AddAttribute ("unicastPreqThreshold",
-        "Maximum number of PREQ receivers, when we send a PREQ as a chain of unicasts",
-        UintegerValue (1),
-        MakeUintegerAccessor (&HwmpProtocol::m_unicastPreqThreshold),
-        MakeUintegerChecker<uint8_t> (1)
-        )
-    .AddAttribute ("unicastDataThreshold",
-        "Maximum number ofbroadcast receivers, when we send a broadcast as a chain of unicasts",
-        UintegerValue (1),
-        MakeUintegerAccessor (&HwmpProtocol::m_unicastDataThreshold),
-        MakeUintegerChecker<uint8_t> (1)
-        )
-    .AddAttribute ("doFlag",
-        "Destination only HWMP flag",
-        BooleanValue (false),
-        MakeBooleanAccessor (&HwmpProtocol::m_doFlag),
-        MakeBooleanChecker ()
-        )
-    .AddAttribute ("rfFlag",
-        "Reply and forward flag",
-        BooleanValue (true),
-        MakeBooleanAccessor (&HwmpProtocol::m_rfFlag),
-        MakeBooleanChecker ()
+    .AddAttribute ( "RandomStart",
+                    "Random delay at first proactive PREQ",
+                    TimeValue (Seconds (0.1)),
+                    MakeTimeAccessor (
+                        &HwmpProtocol::m_randomStart),
+                    MakeTimeChecker ()
+                   )
+    .AddAttribute ( "maxQueueSize",
+                    "Maximum number of packets we can store when resolving route",
+                    UintegerValue (255),
+                    MakeUintegerAccessor (
+                        &HwmpProtocol::m_maxQueueSize),
+                    MakeUintegerChecker<uint16_t> (1)
+                  )
+    .AddAttribute ( "dot11MeshHWMPmaxPREQretries",
+                    "Maximum number of retries before we suppose the destination to be unreachable",
+                    UintegerValue (3),
+                    MakeUintegerAccessor (
+                        &HwmpProtocol::m_dot11MeshHWMPmaxPREQretries),
+                    MakeUintegerChecker<uint8_t> (1)
+                   )
+    .AddAttribute ( "dot11MeshHWMPnetDiameterTraversalTime",
+                    "Time we suppose the packet to go from one edge of the network to another",
+                    TimeValue (MicroSeconds (1024*100)),
+                    MakeTimeAccessor (
+                        &HwmpProtocol::m_dot11MeshHWMPnetDiameterTraversalTime),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "dot11MeshHWMPpreqMinInterval",
+                    "Minimal interval between to successive PREQs",
+                    TimeValue (MicroSeconds (1024*100)),
+                    MakeTimeAccessor (
+                        &HwmpProtocol::m_dot11MeshHWMPpreqMinInterval),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "dot11MeshHWMPperrMinInterval",
+                    "Minimal interval between to successive PREQs",
+                    TimeValue (MicroSeconds (1024*100)),
+                    MakeTimeAccessor (&HwmpProtocol::m_dot11MeshHWMPperrMinInterval),
+                    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)),
+                      MakeTimeAccessor (
+                          &HwmpProtocol::m_dot11MeshHWMPactivePathTimeout),
+                      MakeTimeChecker ()
+                  )
+    .AddAttribute ( "dot11MeshHWMPpathToRootInterval",
+                    "Interval between two successive proactive PREQs",
+                    TimeValue (MicroSeconds (1024*2000)),
+                    MakeTimeAccessor (
+                        &HwmpProtocol::m_dot11MeshHWMPpathToRootInterval),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "dot11MeshHWMPrannInterval",
+                    "Lifetime of poractive routing information",
+                    TimeValue (MicroSeconds (1024*5000)),
+                    MakeTimeAccessor (
+                        &HwmpProtocol::m_dot11MeshHWMPrannInterval),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "maxTtl",
+                    "Initial value of Time To Live field",
+                    UintegerValue (32),
+                    MakeUintegerAccessor (
+                        &HwmpProtocol::m_maxTtl),
+                    MakeUintegerChecker<uint8_t> (2)
+                  )
+    .AddAttribute ( "unicastPerrThreshold",
+                    "Maximum number of PERR receivers, when we send a PERR as a chain of unicasts",
+                    UintegerValue (32),
+                    MakeUintegerAccessor (
+                        &HwmpProtocol::m_unicastPerrThreshold),
+                    MakeUintegerChecker<uint8_t> (1)
+                    )
+    .AddAttribute ( "unicastPreqThreshold",
+                    "Maximum number of PREQ receivers, when we send a PREQ as a chain of unicasts",
+                    UintegerValue (1),
+                    MakeUintegerAccessor (
+                        &HwmpProtocol::m_unicastPreqThreshold),
+                    MakeUintegerChecker<uint8_t> (1)
+                    )
+    .AddAttribute ( "unicastDataThreshold",
+                    "Maximum number ofbroadcast receivers, when we send a broadcast as a chain of unicasts",
+                    UintegerValue (1),
+                    MakeUintegerAccessor (
+                        &HwmpProtocol::m_unicastDataThreshold),
+                    MakeUintegerChecker<uint8_t> (1)
+                  )
+    .AddAttribute ( "doFlag",
+                    "Destination only HWMP flag",
+                    BooleanValue (false),
+                    MakeBooleanAccessor (
+                        &HwmpProtocol::m_doFlag),
+                    MakeBooleanChecker ()
+                  )
+    .AddAttribute ( "rfFlag",
+                    "Reply and forward flag",
+                    BooleanValue (true),
+                    MakeBooleanAccessor (
+                        &HwmpProtocol::m_rfFlag),
+                    MakeBooleanChecker ()
         );
   return tid;
 }
+
 HwmpProtocol::HwmpProtocol ():
-    m_dataSeqno (1),
-    m_hwmpSeqno (1),
-    m_preqId (0),
-    m_rtable (CreateObject<HwmpRtable> ()),
-    m_randomStart(Seconds (0.1)),
-    m_maxQueueSize (255),
-    m_dot11MeshHWMPmaxPREQretries (3),
-    m_dot11MeshHWMPnetDiameterTraversalTime (MicroSeconds (1024*100)),
-    m_dot11MeshHWMPpreqMinInterval (MicroSeconds (1024*100)),
-    m_dot11MeshHWMPperrMinInterval (MicroSeconds (1024*100)),
-    m_dot11MeshHWMPactiveRootTimeout (MicroSeconds (1024*5000)),
-    m_dot11MeshHWMPactivePathTimeout (MicroSeconds (1024*5000)),
-    m_dot11MeshHWMPpathToRootInterval (MicroSeconds (1024*2000)),
-    m_dot11MeshHWMPrannInterval (MicroSeconds (1024*5000)),
-    m_isRoot (false),
-    m_maxTtl (32),
-    m_unicastPerrThreshold (32),
-    m_unicastPreqThreshold (1),
-    m_unicastDataThreshold (1),
-    m_doFlag (false),
-    m_rfFlag (false)
+  m_dataSeqno (1),
+  m_hwmpSeqno (1),
+  m_preqId (0),
+  m_rtable (CreateObject<HwmpRtable> ()),
+  m_randomStart(Seconds (0.1)),
+  m_maxQueueSize (255),
+  m_dot11MeshHWMPmaxPREQretries (3),
+  m_dot11MeshHWMPnetDiameterTraversalTime (MicroSeconds (1024*100)),
+  m_dot11MeshHWMPpreqMinInterval (MicroSeconds (1024*100)),
+  m_dot11MeshHWMPperrMinInterval (MicroSeconds (1024*100)),
+  m_dot11MeshHWMPactiveRootTimeout (MicroSeconds (1024*5000)),
+  m_dot11MeshHWMPactivePathTimeout (MicroSeconds (1024*5000)),
+  m_dot11MeshHWMPpathToRootInterval (MicroSeconds (1024*2000)),
+  m_dot11MeshHWMPrannInterval (MicroSeconds (1024*5000)),
+  m_isRoot (false),
+  m_maxTtl (32),
+  m_unicastPerrThreshold (32),
+  m_unicastPreqThreshold (1),
+  m_unicastDataThreshold (1),
+  m_doFlag (false),
+  m_rfFlag (false)
 {
+
   if(m_isRoot)
-    SetRoot ();
+    {
+      SetRoot ();
+    }
 }
 
 HwmpProtocol::~HwmpProtocol ()
@@ -179,7 +200,9 @@
 HwmpProtocol::DoDispose ()
 {
   for (std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.begin (); i != m_preqTimeouts.end(); i ++)
-    i->second.Cancel ();
+    {
+      i->second.Cancel ();
+    }
   m_preqTimeouts.clear ();
   m_lastDataSeqno.clear ();
   m_lastHwmpSeqno.clear ();
@@ -203,62 +226,62 @@
   HwmpTag tag;
   if (sourceIface == GetMeshPoint ()->GetIfIndex())
     // packet from level 3
-  {
-    if (packet->PeekPacketTag(tag))
     {
-      NS_FATAL_ERROR ("HWMP tag has come with a packet from upper layer. This must not occur...");
+      if (packet->PeekPacketTag(tag))
+        {
+          NS_FATAL_ERROR ("HWMP tag has come with a packet from upper layer. This must not occur...");
+        }
+      //Filling TAG:
+      if (destination == Mac48Address::GetBroadcast ())
+        {
+          tag.SetSeqno (m_dataSeqno++);
+        }
+      tag.SetTtl (m_maxTtl);
     }
-    //Filling TAG:
-    if (destination == Mac48Address::GetBroadcast ())
-      {
-        tag.SetSeqno (m_dataSeqno++);
-      }
-    tag.SetTtl (m_maxTtl);
-  }
   else
-  {
-    if (!packet->RemovePacketTag(tag))
     {
-      NS_FATAL_ERROR ("HWMP tag is supposed to be here at this point.");
+      if (!packet->RemovePacketTag(tag))
+        {
+          NS_FATAL_ERROR ("HWMP tag is supposed to be here at this point.");
+        }
+      tag.DecrementTtl ();
+      if (tag.GetTtl () == 0)
+        {
+          m_stats.droppedTtl ++;
+          return false;
+        }
     }
-    tag.DecrementTtl ();
-    if (tag.GetTtl () == 0)
+  if (destination == Mac48Address::GetBroadcast ())
     {
-      m_stats.droppedTtl ++;
-      return false;
-    }
-  }
-  if (destination == Mac48Address::GetBroadcast ())
-  {
-    m_stats.txBroadcast ++;
-    m_stats.txBytes += packet->GetSize ();
-    //channel IDs where we have already sent broadcast:
-    std::vector<uint16_t> channels;
-    for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
-    {
-      bool should_send = true;
-      for (std::vector<uint16_t>::const_iterator chan = channels.begin(); chan != channels.end(); chan ++)
+      m_stats.txBroadcast ++;
+      m_stats.txBytes += packet->GetSize ();
+      //channel IDs where we have already sent broadcast:
+      std::vector<uint16_t> channels;
+      for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
         {
-          if ((*chan) == plugin->second->GetChannelId ())
+          bool should_send = true;
+          for (std::vector<uint16_t>::const_iterator chan = channels.begin(); chan != channels.end(); chan ++)
+            {
+              if ((*chan) == plugin->second->GetChannelId ())
+                {
+                  should_send = false;
+                }
+            }
+          if (!should_send)
             {
-              should_send = false;
+              continue;
+            }
+          channels.push_back(plugin->second->GetChannelId ());
+          std::vector<Mac48Address> receivers = GetBroadcastReceivers (plugin->first);
+          for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end(); i ++)
+            {
+              Ptr<Packet> packet_copy = packet->Copy();
+              tag.SetAddress (*i);
+              packet_copy->AddPacketTag (tag);
+              routeReply (true, packet_copy, source, destination, protocolType, plugin->first);
             }
         }
-      if (!should_send)
-        {
-          continue;
-        }
-      channels.push_back(plugin->second->GetChannelId ());
-      std::vector<Mac48Address> receivers = GetBroadcastReceivers (plugin->first);
-      for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end(); i ++)
-      {
-        Ptr<Packet> packet_copy = packet->Copy();
-        tag.SetAddress (*i);
-        packet_copy->AddPacketTag (tag);
-        routeReply (true, packet_copy, source, destination, protocolType, plugin->first);
-      }
     }
-  }
   else
     {
       return ForwardUnicast (sourceIface, source, destination, packet, protocolType, routeReply, tag.GetTtl ());
@@ -271,9 +294,9 @@
 {
   HwmpTag tag;
   if (!packet->RemovePacketTag (tag))
-  {
-    NS_FATAL_ERROR ("HWMP tag must exist when packet received from the network");
-  }
+    {
+      NS_FATAL_ERROR ("HWMP tag must exist when packet received from the network");
+    }
   return true;
 }
 bool
@@ -293,51 +316,51 @@
   //seqno and metric is not used;
   packet->AddPacketTag (tag);
   if (result.retransmitter != Mac48Address::GetBroadcast ())
-  {
-    //reply immediately:
-    routeReply (true, packet, source, destination, protocolType, result.ifIndex);
-    m_stats.txUnicast ++;
-    m_stats.txBytes += packet->GetSize ();
-    return true;
-  }
+    {
+      //reply immediately:
+      routeReply (true, packet, source, destination, protocolType, result.ifIndex);
+      m_stats.txUnicast ++;
+      m_stats.txBytes += packet->GetSize ();
+      return true;
+    }
   if (sourceIface != GetMeshPoint ()->GetIfIndex ())
-  {
-    //Start path error procedure:
-    NS_LOG_DEBUG ("Must Send PERR");
-    result = m_rtable->LookupReactiveExpired (destination);
-    //1.  Lookup expired reactive path. If exists - start path error
-    //    procedure towards a next hop of this path
-    //2.  If there was no reactive path, we lookup expired proactive
-    //    path. If exist - start path error procedure towards path to
-    //    root
-    if (result.retransmitter == Mac48Address::GetBroadcast ())
-      {
-        result = m_rtable->LookupProactiveExpired ();
-      }
-    if (result.retransmitter != Mac48Address::GetBroadcast ())
-      {
-        std::vector<IePerr::FailedDestination> destinations = m_rtable->GetUnreachableDestinations (result.retransmitter);
-        InitiatePathError (MakePathError (destinations));
-      }
-    m_stats.totalDropped ++;
-    return false;
-  }
+    {
+      //Start path error procedure:
+      NS_LOG_DEBUG ("Must Send PERR");
+      result = m_rtable->LookupReactiveExpired (destination);
+      //1.  Lookup expired reactive path. If exists - start path error
+      //    procedure towards a next hop of this path
+      //2.  If there was no reactive path, we lookup expired proactive
+      //    path. If exist - start path error procedure towards path to
+      //    root
+      if (result.retransmitter == Mac48Address::GetBroadcast ())
+        {
+          result = m_rtable->LookupProactiveExpired ();
+        }
+      if (result.retransmitter != Mac48Address::GetBroadcast ())
+        {
+          std::vector<IePerr::FailedDestination> destinations = m_rtable->GetUnreachableDestinations (result.retransmitter);
+          InitiatePathError (MakePathError (destinations));
+        }
+      m_stats.totalDropped ++;
+      return false;
+    }
   //Request a destination:
   result = m_rtable->LookupReactiveExpired (destination);
   if (ShouldSendPreq (destination))
-  {
-    uint32_t originator_seqno = GetNextHwmpSeqno ();
-    uint32_t dst_seqno = 0;
-    if (result.retransmitter != Mac48Address::GetBroadcast ())
-      {
-        dst_seqno = result.seqnum;
-      }
-    m_stats.initiatedPreq ++;
-    for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
-      {
-        i->second->RequestDestination(destination, originator_seqno, dst_seqno);
-      }
-  }
+    {
+      uint32_t originator_seqno = GetNextHwmpSeqno ();
+      uint32_t dst_seqno = 0;
+      if (result.retransmitter != Mac48Address::GetBroadcast ())
+        {
+          dst_seqno = result.seqnum;
+        }
+      m_stats.initiatedPreq ++;
+      for (HwmpProtocolMacMap::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
+        {
+          i->second->RequestDestination(destination, originator_seqno, dst_seqno);
+        }
+    }
   QueuedPacket pkt;
   pkt.pkt = packet;
   pkt.dst = destination;
@@ -346,15 +369,15 @@
   pkt.reply = routeReply;
   pkt.inInterface = sourceIface;
   if (QueuePacket (pkt))
-  {
-    m_stats.totalQueued ++;
-    return true;
-  }
+    {
+      m_stats.totalQueued ++;
+      return true;
+    }
   else
-  {
-    m_stats.totalDropped ++;
-    return false;
-  }
+    {
+      m_stats.totalDropped ++;
+      return false;
+    }
 }
 void
 HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, Mac48Address fromMp, uint32_t metric)
@@ -374,15 +397,15 @@
           return;
         }
       if (i->second == preq.GetOriginatorSeqNumber ())
-      {
-        //find metric
-        std::map<Mac48Address, uint32_t>::const_iterator j = m_lastHwmpMetric.find (preq.GetOriginatorAddress());
-        NS_ASSERT (j != m_lastHwmpSeqno.end());
-        if (j->second <= preq.GetMetric ())
-          {
-            return;
-          }
-      }
+        {
+          //find metric
+          std::map<Mac48Address, uint32_t>::const_iterator j = m_lastHwmpMetric.find (preq.GetOriginatorAddress());
+          NS_ASSERT (j != m_lastHwmpSeqno.end());
+          if (j->second <= preq.GetMetric ())
+            {
+              return;
+            }
+        }
       m_lastHwmpSeqno[preq.GetOriginatorAddress ()] = preq.GetOriginatorSeqNumber ();
       m_lastHwmpMetric[preq.GetOriginatorAddress ()] = preq.GetMetric ();
     }
@@ -393,33 +416,33 @@
       ((m_rtable->LookupReactive(preq.GetOriginatorAddress ())).retransmitter == Mac48Address::GetBroadcast ()) ||
       ((m_rtable->LookupReactive(preq.GetOriginatorAddress ())).metric > preq.GetMetric ())
       )
-  {
-    m_rtable->AddReactivePath (
-        preq.GetOriginatorAddress (),
-        from,
-        interface,
-        preq.GetMetric (),
-        MicroSeconds (preq.GetLifetime () * 1024),
-        preq.GetOriginatorSeqNumber ()
-        );
-    ReactivePathResolved (preq.GetOriginatorAddress ());
-  }
+    {
+      m_rtable->AddReactivePath (
+          preq.GetOriginatorAddress (),
+          from,
+          interface,
+          preq.GetMetric (),
+          MicroSeconds (preq.GetLifetime () * 1024),
+          preq.GetOriginatorSeqNumber ()
+          );
+      ReactivePathResolved (preq.GetOriginatorAddress ());
+    }
   //Add reactive path for precursor:
   if (
       ((m_rtable->LookupReactive (fromMp)).retransmitter == Mac48Address::GetBroadcast ()) ||
       ((m_rtable->LookupReactive (fromMp)).metric > preq.GetMetric ())
       )
-  {
-    m_rtable->AddReactivePath (
-        fromMp,
-        from,
-        interface,
-        metric,
-        MicroSeconds (preq.GetLifetime () * 1024),
-        preq.GetOriginatorSeqNumber ()
-        );
-    ReactivePathResolved (fromMp);
-  }
+    {
+      m_rtable->AddReactivePath (
+          fromMp,
+          from,
+          interface,
+          metric,
+          MicroSeconds (preq.GetLifetime () * 1024),
+          preq.GetOriginatorSeqNumber ()
+          );
+      ReactivePathResolved (fromMp);
+    }
   for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator i = destinations.begin (); i != destinations.end (); i++)
     {
       if ((*i)->GetDestinationAddress () == Mac48Address::GetBroadcast())
@@ -487,7 +510,7 @@
           //we have got from PREQ, and set the rest lifetime of the
           //route if the information is correct
           uint32_t lifetime = result.lifetime.GetMicroSeconds () / 1024;
-          if(lifetime > 0)
+          if (lifetime > 0)
             {
               SendPrep (
                   (*i)->GetDestinationAddress (),
@@ -514,7 +537,7 @@
   //check if must retransmit:
   if (preq.GetDestCount () == 0)
     {
-    return;
+      return;
     }
   //Forward PREQ to all interfaces:
   NS_LOG_DEBUG("I am " << GetAddress () << "retransmitting PREQ:" << preq);
@@ -553,40 +576,40 @@
       ((m_rtable->LookupReactive (prep.GetOriginatorAddress ())).retransmitter == Mac48Address::GetBroadcast ()) ||
       ((m_rtable->LookupReactive (prep.GetOriginatorAddress ())).metric > prep.GetMetric ())
       )
-  {
-    m_rtable->AddReactivePath (
-        prep.GetOriginatorAddress (),
-        from,
-        interface,
-        prep.GetMetric (),
-        MicroSeconds(prep.GetLifetime () * 1024),
-        prep.GetOriginatorSeqNumber ());
-    m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from);
-    if (result.retransmitter != Mac48Address::GetBroadcast ())
-      {
-        m_rtable->AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter);
-      }
-    ReactivePathResolved (prep.GetOriginatorAddress ());
-  }
+    {
+      m_rtable->AddReactivePath (
+          prep.GetOriginatorAddress (),
+          from,
+          interface,
+          prep.GetMetric (),
+          MicroSeconds(prep.GetLifetime () * 1024),
+          prep.GetOriginatorSeqNumber ());
+      m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from);
+      if (result.retransmitter != Mac48Address::GetBroadcast ())
+        {
+          m_rtable->AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter);
+        }
+      ReactivePathResolved (prep.GetOriginatorAddress ());
+    }
   if (
       ((m_rtable->LookupReactive (fromMp)).retransmitter == Mac48Address::GetBroadcast ()) ||
       ((m_rtable->LookupReactive (fromMp)).metric > prep.GetMetric ())
       )
-  {
-    m_rtable->AddReactivePath (
-        fromMp,
-        from,
-        interface,
-        metric,
-        MicroSeconds(prep.GetLifetime () * 1024),
-        prep.GetOriginatorSeqNumber ());
-    ReactivePathResolved (fromMp);
-  }
+    {
+      m_rtable->AddReactivePath (
+          fromMp,
+          from,
+          interface,
+          metric,
+          MicroSeconds(prep.GetLifetime () * 1024),
+          prep.GetOriginatorSeqNumber ());
+      ReactivePathResolved (fromMp);
+    }
   if(prep.GetDestinationAddress () == GetAddress ())
-  {
-    NS_LOG_DEBUG("I am "<<GetAddress ()<<", resolved "<<prep.GetOriginatorAddress ());
-    return;
-  }
+    {
+      NS_LOG_DEBUG("I am "<<GetAddress ()<<", resolved "<<prep.GetOriginatorAddress ());
+      return;
+    }
   if (result.retransmitter == Mac48Address::GetBroadcast ())
     {
       //try to look for default route
@@ -616,9 +639,9 @@
         (result.ifIndex != interface) ||
         (result.seqnum > destinations[i].seqnum)
         ))
-    {
-      retval.push_back(destinations[i]);
-    }
+      {
+        retval.push_back(destinations[i]);
+      }
   }
   if (retval.size() == 0)
     {
@@ -744,9 +767,9 @@
   for (HwmpProtocolMacMap::const_iterator i =  m_interfaces.begin (); i != m_interfaces.end (); i ++)
   {
     std::vector<Mac48Address> receivers_for_interface;
-    for(unsigned int j = 0; j < perr.receivers.size(); j ++)
+    for (unsigned int j = 0; j < perr.receivers.size(); j ++)
       {
-        if(i->first == perr.receivers[j].first)
+        if (i->first == perr.receivers[j].first)
           {
             receivers_for_interface.push_back (perr.receivers[j].second);
           }
@@ -863,10 +886,10 @@
   QueuedPacket retval;
   retval.pkt = 0;
   if (m_rqueue.size () != 0)
-  {
-    retval = m_rqueue[0];
-    m_rqueue.erase (m_rqueue.begin ());
-  }
+    {
+      retval = m_rqueue[0];
+      m_rqueue.erase (m_rqueue.begin ());
+    }
   return retval;
 }
 
@@ -875,7 +898,7 @@
 {
   HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
   NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ());
-  //Send all packets stored for this destination    
+  //Send all packets stored for this destination
   QueuedPacket packet = DequeueFirstPacketByDst (dst);
   while (packet.pkt != 0)
   {
@@ -887,7 +910,7 @@
     m_stats.txUnicast ++;
     m_stats.txBytes += packet.pkt->GetSize ();
     packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
-    
+
     packet = DequeueFirstPacketByDst (dst);
   }
 }
@@ -903,15 +926,15 @@
     //set RA tag for retransmitter:
     HwmpTag tag;
     if (!packet.pkt->RemovePacketTag (tag))
-    {
-      NS_FATAL_ERROR ("HWMP tag must be present at this point");
-    }
+      {
+        NS_FATAL_ERROR ("HWMP tag must be present at this point");
+      }
     tag.SetAddress (result.retransmitter);
     packet.pkt->AddPacketTag (tag);
     m_stats.txUnicast ++;
     m_stats.txBytes += packet.pkt->GetSize ();
     packet.reply (true, packet.pkt, packet.src, packet.dst, packet.protocol, result.ifIndex);
-    
+
     packet = DequeueFirstPacket ();
   }
 }
@@ -1120,8 +1143,10 @@
 {
   m_stats = Statistics::Statistics ();
   for (HwmpProtocolMacMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
+    {
     plugin->second->ResetStats ();
+    }
 }
 
 } //namespace dot11s
-} //namespace ns3
+            } //namespace ns3
--- a/src/devices/mesh/dot11s/hwmp-protocol.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef HWMP_PROTOCOL_H
 #define HWMP_PROTOCOL_H
 
@@ -29,19 +28,21 @@
 #include <vector>
 #include <map>
 
-namespace ns3 {
+namespace ns3
+{
 class MeshPointDevice;
 class Packet;
 class Mac48Address;
-namespace dot11s {
+namespace dot11s
+{
 class HwmpProtocolMac;
 class HwmpRtable;
 class IePreq;
 class IePrep;
 /**
  * \ingroup dot11s
- * 
- * \brief Hybrid wireless mesh protocol -- a routing protocol of IEEE 802.11s draft. 
+ *
+ * \brief Hybrid wireless mesh protocol -- a routing protocol of IEEE 802.11s draft.
  */
 class HwmpProtocol : public MeshL2RoutingProtocol
 {
@@ -50,19 +51,19 @@
   HwmpProtocol ();
   ~HwmpProtocol ();
   void DoDispose ();
-  
+
   /// Route request, inherited from MeshL2RoutingProtocol
   bool RequestRoute (uint32_t  sourceIface, const Mac48Address source, const Mac48Address destination,
       Ptr<const Packet>  packet, uint16_t  protocolType, RouteReplyCallback  routeReply);
   /// Cleanup packet from all tags
   bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
       const Mac48Address destination, Ptr<Packet>  packet, uint16_t&  protocolType);
-  /** 
-   * \brief Install HWMP on given mesh point. 
-   * 
+  /**
+   * \brief Install HWMP on given mesh point.
+   *
    * Installing protocol cause installing its interface MAC plugins.
-   *  
-   * Also MP aggregates all installed protocols, HWMP protocol can be accessed 
+   *
+   * Also MP aggregates all installed protocols, HWMP protocol can be accessed
    * via MeshPointDevice::GetObject<dot11s::HwmpProtocol>();
    */
   bool Install (Ptr<MeshPointDevice>);
@@ -81,11 +82,11 @@
   void ResetStats ();
 private:
   friend class HwmpProtocolMac;
-  
+
   /// Like RequestRoute, but for unicast packets
   bool ForwardUnicast (uint32_t  sourceIface, const Mac48Address source, const Mac48Address destination,
       Ptr<Packet>  packet, uint16_t  protocolType, RouteReplyCallback  routeReply, uint32_t ttl);
-  
+
   ///\name Interaction with HWMP MAC plugin
   //\{
   void ReceivePreq(IePreq preq, Mac48Address from, uint32_t interface, Mac48Address fromMp, uint32_t metric);
@@ -121,15 +122,15 @@
   void InitiatePathError (PathError perr);
   /// \return list of addresses where a PERR should be sent to
   std::vector<std::pair<uint32_t, Mac48Address> > GetPerrReceivers (std::vector<IePerr::FailedDestination> failedDest);
-  
+
   /// \return list of addresses where a PERR should be sent to
   std::vector<Mac48Address> GetPreqReceivers (uint32_t interface);
   /// \return list of addresses where a broadcast should be
   //retransmitted
-  std::vector<Mac48Address> GetBroadcastReceivers (uint32_t interface); 
+  std::vector<Mac48Address> GetBroadcastReceivers (uint32_t interface);
   /**
    * \brief MAC-plugin asks wether the frame can be dropeed. Protocol automatically updates seqno.
-   * 
+   *
    * \return true if frame can be dropped
    * \param uint32_t is the seqno
    * \param Mac48Address is the mesh source addrress of the frame
@@ -145,10 +146,10 @@
     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
-    
+
     QueuedPacket () : pkt(0), protocol(0), inInterface(0) {}
   };
-  
+
   ///\name Methods related to Queue/Dequeue procedures
   //\{
   bool QueuePacket (QueuedPacket packet);
@@ -178,27 +179,27 @@
   ///\}
   ///\name Methods responsible for path discovery retry procedure:
   //\{
-  /** 
-   * \brief checks when the last path discovery procedure was started for a given destination. 
-   * 
+  /**
+   * \brief checks when the last path discovery procedure was started for a given destination.
+   *
    * If the retry counter has not achieved the maximum level - preq should not be sent
    */
   bool  ShouldSendPreq (Mac48Address dst);
-  
-  /** 
-   * \brief Generates PREQ retry when retry timeout has expired and route is still unresolved. 
-   * 
+
+  /**
+   * \brief Generates PREQ retry when retry timeout has expired and route is still unresolved.
+   *
    * When PREQ retry has achieved the maximum level - retry mechanish should be cancelled
    */
   void  RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
   //\}
-  
+
   ///\name Proactive Preq routines:
   //\{
   void SendProactivePreq ();
   //\}
   ///\return address of MeshPointDevice
-  Mac48Address GetAddress (); 
+  Mac48Address GetAddress ();
 private:
   typedef std::map<uint32_t, Ptr<HwmpProtocolMac> > HwmpProtocolMacMap;
   HwmpProtocolMacMap m_interfaces;
@@ -215,10 +216,10 @@
   /// Metric database
   std::map<Mac48Address, uint32_t> m_lastHwmpMetric;
   //\}
-  
+
   /// Routing table
   Ptr<HwmpRtable> m_rtable;
-  
+
   ///\name Timers:
   //\{
   std::map<Mac48Address, EventId> m_preqTimeouts;
@@ -226,9 +227,9 @@
   //Random start in Proactive PREQ propagation
   Time m_randomStart;
   //\}
-  
+
   /// Packet Queue
-  std::vector<QueuedPacket> m_rqueue; 
+  std::vector<QueuedPacket> m_rqueue;
 private:
   ///\name HWMP-protocol parameters (attributes of GetTypeId)
   //\{
@@ -249,7 +250,7 @@
   bool m_doFlag;
   bool m_rfFlag;
   //\}
-  
+
   ///\name Methods needed by HwmpMacLugin to access protocol parameters:
   //\{
   bool GetDoFlag ();
--- a/src/devices/mesh/dot11s/hwmp-rtable.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-rtable.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ns3/object.h"
 #include "ns3/assert.h"
 #include "ns3/simulator.h"
@@ -27,11 +26,13 @@
 
 #include "hwmp-rtable.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
 NS_LOG_COMPONENT_DEFINE ("HwmpRtable");
-  
+
 NS_OBJECT_ENSURE_REGISTERED (HwmpRtable);
 
 TypeId
@@ -55,14 +56,8 @@
   m_routes.clear ();
 }
 void
-HwmpRtable::AddReactivePath (
-  Mac48Address destination,
-  Mac48Address retransmitter,
-  uint32_t interface,
-  uint32_t metric,
-  Time  lifetime,
-  uint32_t seqnum
-)
+HwmpRtable::AddReactivePath (Mac48Address destination, Mac48Address retransmitter, uint32_t interface,
+    uint32_t metric, Time lifetime, uint32_t seqnum)
 {
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   if (i == m_routes.end ())
@@ -71,32 +66,27 @@
       m_routes[destination] = newroute;
     }
   i = m_routes.find (destination);
-  NS_ASSERT (i != m_routes.end());
+  NS_ASSERT (i != m_routes.end ());
   i->second.retransmitter = retransmitter;
   i->second.interface = interface;
   i->second.metric = metric;
-  i->second.whenExpire = Simulator::Now() + lifetime;
+  i->second.whenExpire = Simulator::Now () + lifetime;
   i->second.seqnum = seqnum;
 }
 void
-HwmpRtable::AddProactivePath (
-  uint32_t metric,
-  Mac48Address root,
-  Mac48Address retransmitter,
-  uint32_t interface,
-  Time  lifetime,
-  uint32_t seqnum
-)
+HwmpRtable::AddProactivePath (uint32_t metric, Mac48Address root, Mac48Address retransmitter,
+    uint32_t interface, Time lifetime, uint32_t seqnum)
 {
   m_root.root = root;
   m_root.retransmitter = retransmitter;
   m_root.metric = metric;
-  m_root.whenExpire = Simulator::Now() + lifetime;
+  m_root.whenExpire = Simulator::Now () + lifetime;
   m_root.seqnum = seqnum;
   m_root.interface = interface;
 }
 void
-HwmpRtable::AddPrecursor (Mac48Address destination, uint32_t precursorInterface, Mac48Address precursorAddress)
+HwmpRtable::AddPrecursor (Mac48Address destination, uint32_t precursorInterface,
+    Mac48Address precursorAddress)
 {
   std::pair<uint32_t, Mac48Address> precursor;
   precursor.first = precursorInterface;
@@ -105,7 +95,7 @@
   if (i != m_routes.end ())
     {
       bool should_add = true;
-      for (unsigned int j = 0 ; j < i->second.precursors.size (); j ++)
+      for (unsigned int j = 0; j < i->second.precursors.size (); j++)
         //NB: Only one active route may exist, so do not check
         //interface ID, just address
         if (i->second.precursors[j].second == precursorAddress)
@@ -114,13 +104,21 @@
             break;
           }
       if (should_add)
-        i->second.precursors.push_back (precursor);
+        {
+          i->second.precursors.push_back (precursor);
+        }
     }
-  if(m_root.root == destination)
-    for (unsigned int j = 0 ; j < m_root.precursors.size (); j ++)
-      if (m_root.precursors[j].second == precursorAddress)
-        return;
-  m_root.precursors.push_back(precursor);
+  if (m_root.root == destination)
+    {
+      for (unsigned int j = 0; j < m_root.precursors.size (); j++)
+        {
+          if (m_root.precursors[j].second == precursorAddress)
+            {
+              return;
+            }
+        }
+    }
+  m_root.precursors.push_back (precursor);
 }
 void
 HwmpRtable::DeleteProactivePath ()
@@ -135,7 +133,7 @@
 void
 HwmpRtable::DeleteProactivePath (Mac48Address root)
 {
-  if(m_root.root == root)
+  if (m_root.root == root)
     DeleteProactivePath ();
 }
 void
@@ -143,18 +141,22 @@
 {
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   if (i != m_routes.end ())
-    m_routes.erase (i);
+    {
+      m_routes.erase (i);
+    }
 }
 HwmpRtable::LookupResult
 HwmpRtable::LookupReactive (Mac48Address destination)
 {
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   if (i == m_routes.end ())
-    return LookupResult ();
+    {
+      return LookupResult ();
+    }
   if ((i->second.whenExpire < Simulator::Now ()) && (i->second.whenExpire != Seconds (0)))
     {
       NS_LOG_DEBUG ("Reactive route has expired, sorry.");
-      return LookupResult();
+      return LookupResult ();
     }
   return LookupReactiveExpired (destination);
 }
@@ -163,13 +165,11 @@
 {
   std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.find (destination);
   if (i == m_routes.end ())
-    return LookupResult ();
-  return LookupResult (
-      i->second.retransmitter,
-      i->second.interface,
-      i->second.metric, i->second.seqnum,
-      i->second.whenExpire - Simulator::Now ()
-      );
+    {
+      return LookupResult ();
+    }
+  return LookupResult (i->second.retransmitter, i->second.interface, i->second.metric, i->second.seqnum,
+      i->second.whenExpire - Simulator::Now ());
 }
 HwmpRtable::LookupResult
 HwmpRtable::LookupProactive ()
@@ -184,18 +184,19 @@
 HwmpRtable::LookupResult
 HwmpRtable::LookupProactiveExpired ()
 {
-  return LookupResult(m_root.retransmitter, m_root.interface, m_root.metric, m_root.seqnum, m_root.whenExpire - Simulator::Now ());
+  return LookupResult (m_root.retransmitter, m_root.interface, m_root.metric, m_root.seqnum,
+      m_root.whenExpire - Simulator::Now ());
 }
 std::vector<IePerr::FailedDestination>
 HwmpRtable::GetUnreachableDestinations (Mac48Address peerAddress)
 {
   IePerr::FailedDestination dst;
   std::vector<IePerr::FailedDestination> retval;
-  for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin (); i != m_routes.end(); i++)
+  for (std::map<Mac48Address, ReactiveRoute>::iterator i = m_routes.begin (); i != m_routes.end (); i++)
     if (i->second.retransmitter == peerAddress)
       {
         dst.destination = i->first;
-        i->second.seqnum ++;
+        i->second.seqnum++;
         dst.seqnum = i->second.seqnum;
         retval.push_back (dst);
       }
@@ -215,67 +216,75 @@
   PrecursorList retval;
   std::map<Mac48Address, ReactiveRoute>::iterator route = m_routes.find (destination);
   if (route != m_routes.end ())
-    for (unsigned int i = 0; i < route->second.precursors.size (); i ++)
-      retval.push_back(route->second.precursors[i]);
+    {
+      for (unsigned int i = 0; i < route->second.precursors.size (); i++)
+        {
+          retval.push_back (route->second.precursors[i]);
+        }
+    }
   if (m_root.root == destination)
-    for (unsigned int i = 0; i < m_root.precursors.size (); i ++)
     {
-      bool should_add = true;
-      for(unsigned int j = 0; j < retval.size(); j ++)
-        if(retval[j].second == m_root.precursors[i].second)
-         {
-            should_add = false;
-            break;
-         }
-      if(should_add)
-        retval.push_back(m_root.precursors[i]);
+      for (unsigned int i = 0; i < m_root.precursors.size (); i++)
+        {
+          bool should_add = true;
+          for (unsigned int j = 0; j < retval.size (); j++)
+            if (retval[j].second == m_root.precursors[i].second)
+              {
+                should_add = false;
+                break;
+              }
+          if (should_add)
+            retval.push_back (m_root.precursors[i]);
+        }
     }
   return retval;
 }
-bool HwmpRtable::LookupResult::operator==(const HwmpRtable::LookupResult & o) const
+bool
+HwmpRtable::LookupResult::operator== (const HwmpRtable::LookupResult & o) const
 {
-  return (retransmitter == o.retransmitter
-      && ifIndex == o.ifIndex 
-      && metric  == o.metric
-      && seqnum  == o.seqnum
-    );
+  return (retransmitter == o.retransmitter && ifIndex == o.ifIndex && metric == o.metric && seqnum
+      == o.seqnum);
 }
-bool HwmpRtable::LookupResult::IsValid() const
+bool
+HwmpRtable::LookupResult::IsValid () const
 {
-  return !( retransmitter == Mac48Address::GetBroadcast ()
-        &&  ifIndex == INTERFACE_ANY
-        &&  metric == MAX_METRIC
-        &&  seqnum == 0
-      );
+  return !(retransmitter == Mac48Address::GetBroadcast () && ifIndex == INTERFACE_ANY && metric == MAX_METRIC
+      && seqnum == 0);
 }
 #ifdef RUN_SELF_TESTS
 /// Unit test for HwmpRtable
-class HwmpRtableTest : public Test 
+class HwmpRtableTest : public Test
 {
 public:
   HwmpRtableTest ();
-  virtual bool RunTests(); 
-  
+  virtual bool
+  RunTests ();
+
 private:
   /// Test Add apth and lookup path;
-  void TestLookup ();
+  void
+  TestLookup ();
   /**
    * \name Test add path and try to lookup after entry has expired
    * \{
    */
-  void TestAddPath ();
-  void TestExpire ();
+  void
+  TestAddPath ();
+  void
+  TestExpire ();
   ///\}
   /**
    * \name Test add precursors and find precursor list in rtable
    * \{
    */
-  void TestPrecursorAdd ();
-  void TestPrecursorFind ();
+  void
+  TestPrecursorAdd ();
+  void
+  TestPrecursorFind ();
   ///\}
 private:
   bool result;
-  
+
   Mac48Address dst;
   Mac48Address hop;
   uint32_t iface;
@@ -288,82 +297,83 @@
 /// Test instance
 static HwmpRtableTest g_HwmpRtableTest;
 
-HwmpRtableTest::HwmpRtableTest ()  : Test ("Mesh/802.11s/HwmpRtable"), 
-  result(true),
-  dst ("01:00:00:01:00:01"),
-  hop ("01:00:00:01:00:03"),
-  iface (8010),
-  metric (10),
-  seqnum (1),
-  expire (Seconds (10)) 
+HwmpRtableTest::HwmpRtableTest () :
+  Test ("Mesh/802.11s/HwmpRtable"), result (true), dst ("01:00:00:01:00:01"), hop ("01:00:00:01:00:03"),
+      iface (8010), metric (10), seqnum (1), expire (Seconds (10))
 {
   precursors.push_back (Mac48Address ("00:10:20:30:40:50"));
   precursors.push_back (Mac48Address ("00:11:22:33:44:55"));
   precursors.push_back (Mac48Address ("00:01:02:03:04:05"));
 }
-void HwmpRtableTest::TestLookup ()
+void
+HwmpRtableTest::TestLookup ()
 {
   HwmpRtable::LookupResult correct (hop, iface, metric, seqnum);
-  
+
   // Reactive path
   table->AddReactivePath (dst, hop, iface, metric, expire, seqnum);
   NS_TEST_ASSERT (table->LookupReactive (dst) == correct);
   table->DeleteReactivePath (dst);
-  NS_TEST_ASSERT (! table->LookupReactive (dst).IsValid ());
-  
+  NS_TEST_ASSERT (!table->LookupReactive (dst).IsValid ());
+
   // Proactive
   table->AddProactivePath (metric, dst, hop, iface, expire, seqnum);
   NS_TEST_ASSERT (table->LookupProactive () == correct);
   table->DeleteProactivePath (dst);
-  NS_TEST_ASSERT (! table->LookupProactive ().IsValid ());
+  NS_TEST_ASSERT (!table->LookupProactive ().IsValid ());
 }
-void HwmpRtableTest::TestAddPath ()
+void
+HwmpRtableTest::TestAddPath ()
 {
   table->AddReactivePath (dst, hop, iface, metric, expire, seqnum);
   table->AddProactivePath (metric, dst, hop, iface, expire, seqnum);
 }
-void HwmpRtableTest::TestExpire ()
+void
+HwmpRtableTest::TestExpire ()
 {
   // this is assumed to be called when path records are already expired
   HwmpRtable::LookupResult correct (hop, iface, metric, seqnum);
   NS_TEST_ASSERT (table->LookupReactiveExpired (dst) == correct);
   NS_TEST_ASSERT (table->LookupProactiveExpired () == correct);
-  
-  NS_TEST_ASSERT (! table->LookupReactive (dst).IsValid ());
-  NS_TEST_ASSERT (! table->LookupProactive ().IsValid ());
+
+  NS_TEST_ASSERT (!table->LookupReactive (dst).IsValid ());
+  NS_TEST_ASSERT (!table->LookupProactive ().IsValid ());
 }
-void HwmpRtableTest::TestPrecursorAdd ()
+void
+HwmpRtableTest::TestPrecursorAdd ()
 {
-  for (std::vector<Mac48Address>::const_iterator i = precursors.begin (); i != precursors.end (); i ++)
-  {
-    table->AddPrecursor (dst, iface, *i);
-    // Check that duplicates are filtered
-    table->AddPrecursor (dst, iface, *i);
-  }
+  for (std::vector<Mac48Address>::const_iterator i = precursors.begin (); i != precursors.end (); i++)
+    {
+      table->AddPrecursor (dst, iface, *i);
+      // Check that duplicates are filtered
+      table->AddPrecursor (dst, iface, *i);
+    }
 }
-void HwmpRtableTest::TestPrecursorFind ()
+void
+HwmpRtableTest::TestPrecursorFind ()
 {
   HwmpRtable::PrecursorList precursorList = table->GetPrecursors (dst);
-  NS_TEST_ASSERT(precursors.size () == precursorList.size ());
-  for(unsigned int i = 0; i < precursors.size (); i ++)
-  {
-    NS_TEST_ASSERT(precursorList[i].first == iface);
-    NS_TEST_ASSERT(precursorList[i].second == precursors[i]);
-  }
+  NS_TEST_ASSERT (precursors.size () == precursorList.size ());
+  for (unsigned int i = 0; i < precursors.size (); i++)
+    {
+      NS_TEST_ASSERT (precursorList[i].first == iface);
+      NS_TEST_ASSERT (precursorList[i].second == precursors[i]);
+    }
 }
-bool HwmpRtableTest::RunTests ()
+bool
+HwmpRtableTest::RunTests ()
 {
   table = CreateObject<HwmpRtable> ();
-  
-  Simulator::Schedule (Seconds (0), & HwmpRtableTest::TestLookup, this);
-  Simulator::Schedule (Seconds (1), & HwmpRtableTest::TestAddPath, this);
-  Simulator::Schedule (Seconds (2), & HwmpRtableTest::TestPrecursorAdd, this);
-  Simulator::Schedule (expire + Seconds (2), & HwmpRtableTest::TestExpire, this);
-  Simulator::Schedule (expire + Seconds (3), & HwmpRtableTest::TestPrecursorFind, this);
-  
+
+  Simulator::Schedule (Seconds (0), &HwmpRtableTest::TestLookup, this);
+  Simulator::Schedule (Seconds (1), &HwmpRtableTest::TestAddPath, this);
+  Simulator::Schedule (Seconds (2), &HwmpRtableTest::TestPrecursorAdd, this);
+  Simulator::Schedule (expire + Seconds (2), &HwmpRtableTest::TestExpire, this);
+  Simulator::Schedule (expire + Seconds (3), &HwmpRtableTest::TestPrecursorFind, this);
+
   Simulator::Run ();
   Simulator::Destroy ();
-  
+
   return result;
 }
 #endif // RUN_SELF_TESTS
--- a/src/devices/mesh/dot11s/hwmp-rtable.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-rtable.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef HWMP_RTABLE_H
 #define HWMP_RTABLE_H
 
@@ -26,11 +25,13 @@
 #include "ns3/nstime.h"
 #include "ns3/mac48-address.h"
 #include "ie-dot11s-perr.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief Routing table for HWMP -- 802.11s routing protocol
  */
 class HwmpRtable : public Object
@@ -40,7 +41,7 @@
   const static uint32_t INTERFACE_ANY = 0xffffffff;
   /// Maximum (the best?) path metric
   const static uint32_t MAX_METRIC = 0xffffffff;
-  
+
   /// Route lookup result, return type of LookupXXX methods
   struct LookupResult
   {
@@ -49,10 +50,10 @@
     uint32_t metric;
     uint32_t seqnum;
     Time lifetime;
-    
-    LookupResult(Mac48Address r = Mac48Address::GetBroadcast (), 
-                 uint32_t i = INTERFACE_ANY, 
-                 uint32_t m = MAX_METRIC, 
+
+    LookupResult(Mac48Address r = Mac48Address::GetBroadcast (),
+                 uint32_t i = INTERFACE_ANY,
+                 uint32_t m = MAX_METRIC,
                  uint32_t s = 0,
                  Time l = Seconds(0.0))
       : retransmitter (r),
@@ -62,23 +63,23 @@
         lifetime (l)
     {
     }
-    
-    /// True for valid route 
+
+    /// True for valid route
     bool IsValid() const;
     /// Compare route lookup results, used by tests
     bool operator==(const LookupResult & o) const;
   };
   /// Path precursor = {MAC, interface ID}
   typedef std::vector<std::pair<uint32_t, Mac48Address> > PrecursorList;
-    
+
 public:
   static TypeId GetTypeId ();
   HwmpRtable ();
   ~HwmpRtable ();
   void DoDispose ();
-  
+
   ///\name Add/delete paths
-  //\{ 
+  //\{
   void AddReactivePath (
     Mac48Address destination,
     Mac48Address retransmitter,
@@ -101,7 +102,7 @@
   void DeleteProactivePath (Mac48Address root);
   void DeleteReactivePath (Mac48Address destination);
   //\}
-  
+
   ///\name Lookup
   //\{
   /// Lookup path to destination
@@ -113,10 +114,10 @@
   /// Return all proactive paths, including expired
   LookupResult LookupProactiveExpired ();
   //\}
-  
+
   /// When peer link with a given MAC-address fails - it returns list of unreachable destination addresses
   std::vector<IePerr::FailedDestination> GetUnreachableDestinations (Mac48Address peerAddress);
-  
+
 private:
   /// Route found in reactive mode
   struct ReactiveRoute
@@ -139,7 +140,7 @@
     uint32_t seqnum;
     std::vector<std::pair<uint32_t, Mac48Address> > precursors;
   };
-  
+
   /// List of routes
   std::map<Mac48Address, ReactiveRoute>  m_routes;
   /// Path to proactive tree root MP
--- a/src/devices/mesh/dot11s/hwmp-tag.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-tag.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,19 +18,17 @@
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "hwmp-tag.h"
 
-namespace ns3 {
-namespace dot11s{
+namespace ns3
+{
+namespace dot11s
+{
 
 NS_OBJECT_ENSURE_REGISTERED (HwmpTag);
 //Class HwmpTag:
-HwmpTag::HwmpTag ():
-  m_address (Mac48Address::GetBroadcast ()),
-  m_ttl (0),
-  m_metric (0),
-  m_seqno (0)
+HwmpTag::HwmpTag () :
+  m_address (Mac48Address::GetBroadcast ()), m_ttl (0), m_metric (0), m_seqno (0)
 {
 }
 
@@ -89,9 +87,7 @@
 TypeId
 HwmpTag::GetTypeId ()
 {
-  static TypeId tid = TypeId ("ns3::dot11s::HwmpTag")
-    .SetParent<Tag> ()
-    .AddConstructor<HwmpTag> ();
+  static TypeId tid = TypeId ("ns3::dot11s::HwmpTag") .SetParent<Tag> () .AddConstructor<HwmpTag> ();
   return tid;
 }
 
@@ -104,11 +100,10 @@
 uint32_t
 HwmpTag::GetSerializedSize () const
 {
-  return
-     6 //address
-    +1 //ttl
-    +4 //metric
-    +4; //seqno
+  return 6 //address
+      + 1 //ttl
+      + 4 //metric
+      + 4; //seqno
 }
 
 void
@@ -119,9 +114,11 @@
   m_address.CopyTo (address);
   i.WriteU8 (m_ttl);
   i.WriteU32 (m_metric);
-  i.WriteU32(m_seqno);
-  for (j = 0; j < 6; j ++)
-    i.WriteU8 (address[j]);
+  i.WriteU32 (m_seqno);
+  for (j = 0; j < 6; j++)
+    {
+      i.WriteU8 (address[j]);
+    }
 }
 
 void
@@ -132,8 +129,10 @@
   m_ttl = i.ReadU8 ();
   m_metric = i.ReadU32 ();
   m_seqno = i.ReadU32 ();
-  for (j = 0; j < 6; j ++)
-    address[j] = i.ReadU8 ();
+  for (j = 0; j < 6; j++)
+    {
+      address[j] = i.ReadU8 ();
+    }
   m_address.CopyFrom (address);
 }
 
@@ -141,14 +140,14 @@
 HwmpTag::Print (std::ostream &os) const
 {
   os << "address=" << m_address;
-  os << "ttl="  <<  m_ttl;
+  os << "ttl=" << m_ttl;
   os << "metrc=" << m_metric;
   os << "seqno=" << m_seqno;
 }
 void
 HwmpTag::DecrementTtl ()
 {
-  m_ttl --;
+  m_ttl--;
 }
 } //namespace dot11s
 } //namespace ns3
--- a/src/devices/mesh/dot11s/hwmp-tag.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-tag.h	Wed Jul 22 14:52:42 2009 +0400
@@ -20,15 +20,16 @@
  *          Pavel Boyko <boyko@iitp.ru>
  */
 
-
 #ifndef HWMP_TAG_H
 #define HWMP_TAG_H
 
 #include "ns3/tag.h"
 #include "ns3/object.h"
 #include "ns3/mac48-address.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
  *
--- a/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ie-dot11s-beacon-timing.h"
 #include "ns3/log.h"
 #include "ns3/test.h"
@@ -26,15 +25,15 @@
 
 NS_LOG_COMPONENT_DEFINE ("IeBeaconTiming");
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /*******************************************
  * IeBeaconTimingUnit
  *******************************************/
-IeBeaconTimingUnit::IeBeaconTimingUnit ():
-  m_aid (0),
-  m_lastBeacon (0),
-  m_beaconInterval (0)
+IeBeaconTimingUnit::IeBeaconTimingUnit () :
+  m_aid (0), m_lastBeacon (0), m_beaconInterval (0)
 {
 }
 void
@@ -70,12 +69,12 @@
 /*******************************************
  * IeBeaconTiming
  *******************************************/
-WifiElementId 
+WifiElementId
 IeBeaconTiming::ElementId () const
 {
-    return IE11S_BEACON_TIMING;
+  return IE11S_BEACON_TIMING;
 }
-IeBeaconTiming::IeBeaconTiming ():
+IeBeaconTiming::IeBeaconTiming () :
   m_numOfUnits (0)
 {
 }
@@ -85,51 +84,42 @@
   return m_neighbours;
 }
 void
-IeBeaconTiming::AddNeighboursTimingElementUnit (
-  uint16_t aid,
-  Time  last_beacon, //MicroSeconds!
-  Time  beacon_interval //MicroSeconds!
+IeBeaconTiming::AddNeighboursTimingElementUnit (uint16_t aid, Time last_beacon, //MicroSeconds!
+    Time beacon_interval //MicroSeconds!
 )
 {
   if (m_numOfUnits == 50)
     {
-      NS_LOG_WARN ("Neighbor timing element is ignored, since more than 50 neighbors can not be supported in single information element.");
+      NS_LOG_WARN (
+          "Neighbor timing element is ignored, since more than 50 neighbors can not be supported in single information element.");
       return;
     }
-  //First we lookup if this element already exists 
-  for (NeighboursTimingUnitsList::const_iterator i = m_neighbours.begin (); i != m_neighbours.end(); i++)
+  //First we lookup if this element already exists
+  for (NeighboursTimingUnitsList::const_iterator i = m_neighbours.begin (); i != m_neighbours.end (); i++)
     {
-      if (
-        ((*i)->GetAid () == AidToU8(aid))
-        && ((*i)->GetLastBeacon () == TimestampToU16(last_beacon))
-        && ((*i)->GetBeaconInterval () == BeaconIntervalToU16(beacon_interval))
-      )
+      if (((*i)->GetAid () == AidToU8 (aid)) && ((*i)->GetLastBeacon () == TimestampToU16 (last_beacon))
+          && ((*i)->GetBeaconInterval () == BeaconIntervalToU16 (beacon_interval)))
         {
           NS_LOG_WARN ("Duplicated neighbor timing element is ignored.");
           return;
         }
     }
-  Ptr<IeBeaconTimingUnit>new_element = Create<IeBeaconTimingUnit> ();
-  new_element->SetAid (AidToU8(aid));
-  new_element->SetLastBeacon (TimestampToU16(last_beacon));
-  new_element->SetBeaconInterval (BeaconIntervalToU16(beacon_interval));
+  Ptr<IeBeaconTimingUnit> new_element = Create<IeBeaconTimingUnit> ();
+  new_element->SetAid (AidToU8 (aid));
+  new_element->SetLastBeacon (TimestampToU16 (last_beacon));
+  new_element->SetBeaconInterval (BeaconIntervalToU16 (beacon_interval));
   m_neighbours.push_back (new_element);
   m_numOfUnits++;
 }
 void
-IeBeaconTiming::DelNeighboursTimingElementUnit (
-  uint16_t aid,
-  Time  last_beacon, //MicroSeconds!
-  Time  beacon_interval //MicroSeconds!
+IeBeaconTiming::DelNeighboursTimingElementUnit (uint16_t aid, Time last_beacon, //MicroSeconds!
+    Time beacon_interval //MicroSeconds!
 )
 {
-  for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin (); i != m_neighbours.end(); i++)
+  for (NeighboursTimingUnitsList::iterator i = m_neighbours.begin (); i != m_neighbours.end (); i++)
     {
-      if (
-        ((*i)->GetAid () == AidToU8(aid))
-        && ((*i)->GetLastBeacon () == TimestampToU16(last_beacon))
-        && ((*i)->GetBeaconInterval () == BeaconIntervalToU16(beacon_interval))
-      )
+      if (((*i)->GetAid () == AidToU8 (aid)) && ((*i)->GetLastBeacon () == TimestampToU16 (last_beacon))
+          && ((*i)->GetBeaconInterval () == BeaconIntervalToU16 (beacon_interval)))
         {
           m_neighbours.erase (i);
           m_numOfUnits--;
@@ -142,12 +132,12 @@
 {
   uint16_t to_delete = 0;
   uint16_t i;
-  for (NeighboursTimingUnitsList::iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++)
+  for (NeighboursTimingUnitsList::iterator j = m_neighbours.begin (); j != m_neighbours.end (); j++)
     {
       to_delete++;
       (*j) = 0;
     }
-  for (i = 0; i < to_delete; i ++)
+  for (i = 0; i < to_delete; i++)
     {
       m_neighbours.pop_back ();
     }
@@ -157,77 +147,79 @@
 uint8_t
 IeBeaconTiming::GetInformationSize () const
 {
-  return (5*m_numOfUnits);
+  return (5* m_numOfUnits );
 }
 void
 IeBeaconTiming::PrintInformation (std::ostream& os) const
 {
-  os <<"Number of units: " << (uint16_t)m_numOfUnits << "\n";
-  for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++)
+  os << "Number of units: " << (uint16_t) m_numOfUnits << "\n";
+  for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end (); j++)
     {
-      os<< "AID=" << (uint16_t)(*j)->GetAid () << ", Last beacon was at "
-        << (*j)->GetLastBeacon ()<<", with beacon interval " << (*j)->GetBeaconInterval () << "\n";
+      os << "AID=" << (uint16_t) (*j)->GetAid () << ", Last beacon was at " << (*j)->GetLastBeacon ()
+          << ", with beacon interval " << (*j)->GetBeaconInterval () << "\n";
     }
 }
 void
 IeBeaconTiming::SerializeInformation (Buffer::Iterator i) const
 {
-  for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end(); j++)
+  for (NeighboursTimingUnitsList::const_iterator j = m_neighbours.begin (); j != m_neighbours.end (); j++)
     {
       i.WriteU8 ((*j)->GetAid ());
       i.WriteHtolsbU16 ((*j)->GetLastBeacon ());
       i.WriteHtolsbU16 ((*j)->GetBeaconInterval ());
     }
 }
-uint8_t 
+uint8_t
 IeBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
-  m_numOfUnits = length/5;
-  for (int j = 0; j < m_numOfUnits; j ++)
+  m_numOfUnits = length / 5;
+  for (int j = 0; j < m_numOfUnits; j++)
     {
       Ptr<IeBeaconTimingUnit> new_element = Create<IeBeaconTimingUnit> ();
-      new_element->SetAid (i.ReadU8());
-      new_element->SetLastBeacon (i.ReadLsbtohU16());
-      new_element->SetBeaconInterval (i.ReadLsbtohU16());
+      new_element->SetAid (i.ReadU8 ());
+      new_element->SetLastBeacon (i.ReadLsbtohU16 ());
+      new_element->SetBeaconInterval (i.ReadLsbtohU16 ());
       m_neighbours.push_back (new_element);
     }
   return i.GetDistanceFrom (start);
-};
+}
+;
 uint16_t
 IeBeaconTiming::TimestampToU16 (Time t)
 {
-  return ((uint16_t) ((t.GetMicroSeconds() >> 8)&0xffff));
-};
+  return ((uint16_t) ((t.GetMicroSeconds () >> 8) & 0xffff));
+}
+;
 
-uint16_t 
+uint16_t
 IeBeaconTiming::BeaconIntervalToU16 (Time t)
 {
-  return ((uint16_t) (t.GetMicroSeconds() >>10)&0xffff);
+  return ((uint16_t) (t.GetMicroSeconds () >> 10) & 0xffff);
 }
 uint8_t
 IeBeaconTiming::AidToU8 (uint16_t x)
 {
-  return (uint8_t) (x&0xff);
-};
+  return (uint8_t) (x & 0xff);
+}
+;
 
-bool operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b)
+bool
+operator== (const IeBeaconTimingUnit & a, const IeBeaconTimingUnit & b)
 {
-  return (
-      (a.GetAid () == b.GetAid ()) &&
-      (a.GetLastBeacon () == b.GetLastBeacon()) &&
-      (a.GetBeaconInterval () == b.GetBeaconInterval ())
-      );
+  return ((a.GetAid () == b.GetAid ()) && (a.GetLastBeacon () == b.GetLastBeacon ())
+      && (a.GetBeaconInterval () == b.GetBeaconInterval ()));
 }
-bool operator== (const IeBeaconTiming & a, const IeBeaconTiming& b)
+bool
+operator== (const IeBeaconTiming & a, const IeBeaconTiming& b)
 {
-  if(a.m_numOfUnits != b.m_numOfUnits)
+  if (a.m_numOfUnits != b.m_numOfUnits)
     {
       return false;
     }
-  for(unsigned int i = 0; i < a.m_neighbours.size (); i ++)
+  for (unsigned int i = 0; i < a.m_neighbours.size (); i++)
     {
-      if(!(*PeekPointer(a.m_neighbours[i]) == *PeekPointer(b.m_neighbours[i])))
+      if (!(*PeekPointer (a.m_neighbours[i]) == *PeekPointer (b.m_neighbours[i])))
         {
           return false;
         }
@@ -235,26 +227,31 @@
   return true;
 }
 
-#ifdef RUN_SELF_TESTS  
-struct IeBeaconTimingBist : public IeTest 
+#ifdef RUN_SELF_TESTS
+struct IeBeaconTimingBist : public IeTest
 {
-  IeBeaconTimingBist () : IeTest ("Mesh/802.11s/IE/BeaconTiming") {}
-  virtual bool RunTests(); 
+  IeBeaconTimingBist () :
+    IeTest ("Mesh/802.11s/IE/BeaconTiming")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IeBeaconTimingBist g_IePerrBist;
 
-bool IeBeaconTimingBist::RunTests ()
+bool
+IeBeaconTimingBist::RunTests ()
 {
-  bool result(true);
+  bool result (true);
   // create test information element
   IeBeaconTiming a;
-  a.IeBeaconTiming::AddNeighboursTimingElementUnit (1,Seconds(1.0), Seconds(4.0));
-  a.IeBeaconTiming::AddNeighboursTimingElementUnit (2,Seconds(2.0), Seconds(3.0));
-  a.IeBeaconTiming::AddNeighboursTimingElementUnit (3,Seconds(3.0), Seconds(2.0));
-  a.IeBeaconTiming::AddNeighboursTimingElementUnit (4,Seconds(4.0), Seconds(1.0));
-  
+  a.IeBeaconTiming::AddNeighboursTimingElementUnit (1, Seconds (1.0), Seconds (4.0));
+  a.IeBeaconTiming::AddNeighboursTimingElementUnit (2, Seconds (2.0), Seconds (3.0));
+  a.IeBeaconTiming::AddNeighboursTimingElementUnit (3, Seconds (3.0), Seconds (2.0));
+  a.IeBeaconTiming::AddNeighboursTimingElementUnit (4, Seconds (4.0), Seconds (1.0));
+
   result = TestRoundtripSerialization (a);
   return result;
 }
--- a/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-beacon-timing.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef WIFI_TIMING_ELEMENT_H
 #define WIFI_TIMING_ELEMENT_H
 
@@ -26,8 +25,10 @@
 #include "ns3/nstime.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
  * \brief Describes one unit of beacon timing element
@@ -43,7 +44,7 @@
   uint8_t GetAid () const;
   uint16_t GetLastBeacon () const;
   uint16_t GetBeaconInterval () const;
-  
+
 private:
   /// Least significant octet of AID:
   uint8_t m_aid;
@@ -89,7 +90,7 @@
   uint8_t  GetInformationSize () const;
   void SerializeInformation (Buffer::Iterator i) const;
   uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
-  void PrintInformation (std::ostream& os) const; 
+  void PrintInformation (std::ostream& os) const;
   /**
    * Converters:
    */
--- a/src/devices/mesh/dot11s/ie-dot11s-configuration.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-configuration.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -19,27 +19,26 @@
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  */
 
-
 #include "ie-dot11s-configuration.h"
 #include "ns3/test.h"
 #include "ns3/packet.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
-dot11sMeshCapability::dot11sMeshCapability ():
-    acceptPeerLinks (true),
-    MCCASupported (false),
-    MCCAEnabled (false),
-    forwarding (true),
-    beaconTimingReport (true),
-    TBTTAdjustment (true),
-    powerSaveLevel (false)
-{}
-uint8_t dot11sMeshCapability::GetSerializedSize () const
+dot11sMeshCapability::dot11sMeshCapability () :
+  acceptPeerLinks (true), MCCASupported (false), MCCAEnabled (false), forwarding (true), beaconTimingReport (
+      true), TBTTAdjustment (true), powerSaveLevel (false)
+{
+}
+uint8_t
+dot11sMeshCapability::GetSerializedSize () const
 {
   return 2;
 }
-uint16_t dot11sMeshCapability::GetUint16 () const
+uint16_t
+dot11sMeshCapability::GetUint16 () const
 {
   uint16_t result = 0;
   if (acceptPeerLinks)
@@ -72,53 +71,53 @@
     }
   return result;
 }
-Buffer::Iterator dot11sMeshCapability::Serialize (Buffer::Iterator i) const
+Buffer::Iterator
+dot11sMeshCapability::Serialize (Buffer::Iterator i) const
 {
   i.WriteHtolsbU16 (GetUint16 ());
   return i;
 }
-Buffer::Iterator dot11sMeshCapability::Deserialize (Buffer::Iterator i)
+Buffer::Iterator
+dot11sMeshCapability::Deserialize (Buffer::Iterator i)
 {
-  uint16_t  cap = i.ReadLsbtohU16 ();
-  acceptPeerLinks    = Is (cap, 0);
-  MCCASupported      = Is (cap, 1);
-  MCCAEnabled        = Is (cap, 2);
-  forwarding         = Is (cap, 3);
+  uint16_t cap = i.ReadLsbtohU16 ();
+  acceptPeerLinks = Is (cap, 0);
+  MCCASupported = Is (cap, 1);
+  MCCAEnabled = Is (cap, 2);
+  forwarding = Is (cap, 3);
   beaconTimingReport = Is (cap, 4);
-  TBTTAdjustment     = Is (cap, 5);
-  powerSaveLevel     = Is (cap, 6);
+  TBTTAdjustment = Is (cap, 5);
+  powerSaveLevel = Is (cap, 6);
   return i;
 }
-bool dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const
+bool
+dot11sMeshCapability::Is (uint16_t cap, uint8_t n) const
 {
   uint16_t mask = 1 << n;
   return (cap & mask);
 }
 WifiElementId
 IeConfiguration::ElementId () const
-{    
+{
   return IE11S_MESH_CONFIGURATION;
 }
 
-IeConfiguration::IeConfiguration ():
-    m_APSPId (PROTOCOL_HWMP),
-    m_APSMId (METRIC_AIRTIME),
-    m_CCMId (CONGESTION_NULL),
-    m_SPId (SYNC_NEIGHBOUR_OFFSET),
-    m_APId (AUTH_NULL),
-    m_neighbors (0)
-{}
+IeConfiguration::IeConfiguration () :
+  m_APSPId (PROTOCOL_HWMP), m_APSMId (METRIC_AIRTIME), m_CCMId (CONGESTION_NULL), m_SPId (
+      SYNC_NEIGHBOUR_OFFSET), m_APId (AUTH_NULL), m_neighbors (0)
+{
+}
 uint8_t
 IeConfiguration::GetInformationSize () const
 {
   return 1 // Version
-    + 4 // APSPId
-    + 4 // APSMId
-    + 4 // CCMId
-    + 4 // SPId
-    + 4 // APId
-    + 1 // Mesh formation info (see 7.3.2.86.6 of 802.11s draft 3.0)
-    + m_meshCap.GetSerializedSize ();
+      + 4 // APSPId
+      + 4 // APSMId
+      + 4 // CCMId
+      + 4 // SPId
+      + 4 // APId
+      + 1 // Mesh formation info (see 7.3.2.86.6 of 802.11s draft 3.0)
+      + m_meshCap.GetSerializedSize ();
 }
 void
 IeConfiguration::SerializeInformation (Buffer::Iterator i) const
@@ -142,15 +141,15 @@
 {
   Buffer::Iterator start = i;
   uint8_t version;
-  version  = i.ReadU8 ();
+  version = i.ReadU8 ();
   // Active Path Selection Protocol ID:
-  m_APSPId  = (dot11sPathSelectionProtocol)i.ReadLsbtohU32 ();
+  m_APSPId = (dot11sPathSelectionProtocol) i.ReadLsbtohU32 ();
   // Active Path Metric ID:
-  m_APSMId = (dot11sPathSelectionMetric)i.ReadLsbtohU32 ();
+  m_APSMId = (dot11sPathSelectionMetric) i.ReadLsbtohU32 ();
   // Congestion Control Mode ID:
-  m_CCMId  = (dot11sCongestionControlMode)i.ReadLsbtohU32 ();
-  m_SPId   = (dot11sSynchronizationProtocolIdentifier)i.ReadLsbtohU32 ();
-  m_APId   = (dot11sAuthenticationProtocol)i.ReadLsbtohU32 ();
+  m_CCMId = (dot11sCongestionControlMode) i.ReadLsbtohU32 ();
+  m_SPId = (dot11sSynchronizationProtocolIdentifier) i.ReadLsbtohU32 ();
+  m_APId = (dot11sAuthenticationProtocol) i.ReadLsbtohU32 ();
   m_neighbors = (i.ReadU8 () >> 1) & 0xF;
   i = m_meshCap.Deserialize (i);
   return i.GetDistanceFrom (start);
@@ -158,23 +157,23 @@
 void
 IeConfiguration::PrintInformation (std::ostream& os) const
 {
-  os<<"Number of neighbors:               = " << (uint16_t)m_neighbors <<
-    "\nActive Path Selection Protocol ID: = " << (uint32_t)m_APSPId <<
-    "\nActive Path Selection Metric ID:   = " << (uint32_t)m_APSMId <<
-    "\nCongestion Control Mode ID:        = " << (uint32_t)m_CCMId <<
-    "\nSynchronize protocol ID:           = " << (uint32_t)m_SPId <<
-    "\nAuthentication protocol ID:        = " << (uint32_t)m_APId <<
-    "\nCapabilities:                      = " << m_meshCap.GetUint16 () << "\n";
+  os << "Number of neighbors:               = " << (uint16_t) m_neighbors
+      << "\nActive Path Selection Protocol ID: = " << (uint32_t) m_APSPId
+      << "\nActive Path Selection Metric ID:   = " << (uint32_t) m_APSMId
+      << "\nCongestion Control Mode ID:        = " << (uint32_t) m_CCMId
+      << "\nSynchronize protocol ID:           = " << (uint32_t) m_SPId
+      << "\nAuthentication protocol ID:        = " << (uint32_t) m_APId
+      << "\nCapabilities:                      = " << m_meshCap.GetUint16 () << "\n";
 }
 void
 IeConfiguration::SetRouting (dot11sPathSelectionProtocol routingId)
 {
-  m_APSPId  =  routingId;
+  m_APSPId = routingId;
 }
 void
 IeConfiguration::SetMetric (dot11sPathSelectionMetric metricId)
 {
-  m_APSMId =  metricId;
+  m_APSMId = metricId;
 }
 bool
 IeConfiguration::IsHWMP ()
@@ -184,7 +183,7 @@
 bool
 IeConfiguration::IsAirtime ()
 {
-  return (m_APSMId  == METRIC_AIRTIME);
+  return (m_APSMId == METRIC_AIRTIME);
 }
 void
 IeConfiguration::SetNeighborCount (uint8_t neighbors)
@@ -196,51 +195,47 @@
 {
   return m_neighbors;
 }
-dot11sMeshCapability const& IeConfiguration::MeshCapability ()
+dot11sMeshCapability const&
+IeConfiguration::MeshCapability ()
 {
   return m_meshCap;
 }
-bool operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b)
+bool
+operator== (const dot11sMeshCapability & a, const dot11sMeshCapability & b)
 {
-  return (
-      (a.acceptPeerLinks == b.acceptPeerLinks) &&
-      (a.MCCASupported == b.MCCASupported) &&
-      (a.MCCAEnabled == b.MCCAEnabled) &&
-      (a.forwarding == b.forwarding) &&
-      (a.beaconTimingReport == b.beaconTimingReport) &&
-      (a.TBTTAdjustment == b.TBTTAdjustment) &&
-      (a.powerSaveLevel == b.powerSaveLevel)
-      );
+  return ((a.acceptPeerLinks == b.acceptPeerLinks) && (a.MCCASupported == b.MCCASupported) && (a.MCCAEnabled
+      == b.MCCAEnabled) && (a.forwarding == b.forwarding) && (a.beaconTimingReport == b.beaconTimingReport)
+      && (a.TBTTAdjustment == b.TBTTAdjustment) && (a.powerSaveLevel == b.powerSaveLevel));
 }
-bool operator== (const IeConfiguration & a, const IeConfiguration & b)
+bool
+operator== (const IeConfiguration & a, const IeConfiguration & b)
 {
-  return (
-      (a.m_APSPId == b.m_APSPId) &&
-      (a.m_APSMId == b.m_APSMId) &&
-      (a.m_CCMId == b.m_CCMId) &&
-      (a.m_SPId == b.m_SPId) &&
-      (a.m_APId == b.m_APId) &&
-      (a.m_neighbors == b.m_neighbors) &&
-      (a.m_meshCap == b.m_meshCap)
-      );
+  return ((a.m_APSPId == b.m_APSPId) && (a.m_APSMId == b.m_APSMId) && (a.m_CCMId == b.m_CCMId) && (a.m_SPId
+      == b.m_SPId) && (a.m_APId == b.m_APId) && (a.m_neighbors == b.m_neighbors) && (a.m_meshCap
+      == b.m_meshCap));
 }
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IePreq
-struct IeConfigurationBist : public IeTest 
+struct IeConfigurationBist : public IeTest
 {
-  IeConfigurationBist () : IeTest ("Mesh/802.11s/IE/Configuration") {}
-  virtual bool RunTests(); 
+  IeConfigurationBist () :
+    IeTest ("Mesh/802.11s/IE/Configuration")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IeConfigurationBist g_IeConfigurationBist;
 
-bool IeConfigurationBist::RunTests ()
+bool
+IeConfigurationBist::RunTests ()
 {
-  bool result(true);
+  bool result (true);
   IeConfiguration a;
-  
+
   result = TestRoundtripSerialization (a);
   return result;
 }
--- a/src/devices/mesh/dot11s/ie-dot11s-id.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-id.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -21,11 +21,13 @@
 #include "ie-dot11s-id.h"
 #include "ns3/assert.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 IeMeshId::IeMeshId ()
 {
-  for (uint8_t i = 0; i < 32; i++) 
+  for (uint8_t i = 0; i < 32; i++)
     {
       m_meshId[i] = 0;
     }
@@ -35,14 +37,14 @@
   NS_ASSERT (s.size () < 32);
   const char *meshid = s.c_str ();
   uint8_t len = 0;
-  while (*meshid != 0 && len < 32) 
+  while (*meshid != 0 && len < 32)
     {
       m_meshId[len] = *meshid;
       meshid++;
       len++;
     }
   NS_ASSERT (len <= 32);
-  while (len < 33) 
+  while (len < 33)
     {
       m_meshId[len] = 0;
       len++;
@@ -51,28 +53,26 @@
 WifiElementId
 IeMeshId::ElementId () const
 {
-  return IE11S_MESH_ID; 
+  return IE11S_MESH_ID;
 }
-bool 
+bool
 IeMeshId::IsEqual (IeMeshId const &o) const
 {
   uint8_t i = 0;
-  while (i < 32 && 
-         m_meshId[i] == o.m_meshId[i] &&
-         m_meshId[i] != 0) 
+  while (i < 32 && m_meshId[i] == o.m_meshId[i] && m_meshId[i] != 0)
     {
       i++;
     }
-  if (m_meshId[i] != o.m_meshId[i]) 
+  if (m_meshId[i] != o.m_meshId[i])
     {
       return false;
     }
   return true;
 }
-bool 
+bool
 IeMeshId::IsBroadcast (void) const
 {
-  if (m_meshId[0] == 0) 
+  if (m_meshId[0] == 0)
     {
       return true;
     }
@@ -81,9 +81,9 @@
 char *
 IeMeshId::PeekString (void) const
 {
-  return (char *)m_meshId;
+  return (char *) m_meshId;
 }
-uint8_t 
+uint8_t
 IeMeshId::GetInformationSize (void) const
 {
   uint8_t size = 0;
@@ -100,8 +100,8 @@
   uint8_t size = 0;
   while (m_meshId[size] != 0 && size < 32)
     {
-      i.WriteU8 (m_meshId [size]);
-      size ++;
+      i.WriteU8 (m_meshId[size]);
+      size++;
     }
 }
 uint8_t
@@ -111,27 +111,31 @@
   NS_ASSERT (length <= 32);
   i.Read (m_meshId, length);
   m_meshId[length] = 0;
-  return i.GetDistanceFrom(start);
+  return i.GetDistanceFrom (start);
 }
-void 
+void
 IeMeshId::PrintInformation (std::ostream& os) const
 {
-  os << "meshId =  " << PeekString (); 
+  os << "meshId =  " << PeekString ();
 }
-bool operator== (const IeMeshId & a, const IeMeshId & b)
+bool
+operator== (const IeMeshId & a, const IeMeshId & b)
 {
   bool result (true);
   uint8_t size = 0;
 
-  while(size < 32)
-  {
-    result = result && (a.m_meshId[size] == b.m_meshId[size]);
-    if(a.m_meshId[size] == 0)
-      return result;
-    size ++;
-  }
+  while (size < 32)
+    {
+      result = result && (a.m_meshId[size] == b.m_meshId[size]);
+      if (a.m_meshId[size] == 0)
+        {
+          return result;
+        }
+      size++;
+    }
   return result;
-};
+}
+;
 
 std::ostream &
 operator << (std::ostream &os, const IeMeshId &meshId)
@@ -142,21 +146,26 @@
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IeMeshId
-struct IeMeshIdBist : public IeTest 
+struct IeMeshIdBist : public IeTest
 {
-  IeMeshIdBist () : IeTest ("Mesh/802.11s/IE/MESH_ID") {}
-  virtual bool RunTests(); 
+  IeMeshIdBist () :
+    IeTest ("Mesh/802.11s/IE/MESH_ID")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IeMeshIdBist g_IeMeshIdBist;
 
-bool IeMeshIdBist::RunTests ()
+bool
+IeMeshIdBist::RunTests ()
 {
-  bool result(true);
-  
+  bool result (true);
+
   // create test information element
-  IeMeshId a("qwerty");
+  IeMeshId a ("qwerty");
   result = result && TestRoundtripSerialization (a);
   return result;
 }
--- a/src/devices/mesh/dot11s/ie-dot11s-id.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-id.h	Wed Jul 22 14:52:42 2009 +0400
@@ -25,8 +25,10 @@
 #include "ns3/buffer.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \brief a IEEE 802.11s Mesh ID 7.3.287 of 802.11s draft 3.0
  *
--- a/src/devices/mesh/dot11s/ie-dot11s-metric-report.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-metric-report.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -21,10 +21,12 @@
 #include "ie-dot11s-metric-report.h"
 #include "ns3/assert.h"
 
-namespace ns3 {
-namespace dot11s {
-IeLinkMetricReport::IeLinkMetricReport ()
-  : m_metric (0)
+namespace ns3
+{
+namespace dot11s
+{
+IeLinkMetricReport::IeLinkMetricReport () :
+  m_metric (0)
 {
 }
 IeLinkMetricReport::IeLinkMetricReport (uint32_t metric)
@@ -34,12 +36,12 @@
 WifiElementId
 IeLinkMetricReport::ElementId () const
 {
-  return IE11S_LINK_METRIC_REPORT; 
+  return IE11S_LINK_METRIC_REPORT;
 }
-uint8_t 
+uint8_t
 IeLinkMetricReport::GetInformationSize (void) const
 {
-  return sizeof (uint32_t);
+  return sizeof(uint32_t);
 }
 uint32_t
 IeLinkMetricReport::GetMetric ()
@@ -60,37 +62,44 @@
 IeLinkMetricReport::DeserializeInformation (Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
-  m_metric = i.ReadLsbtohU32();
-  return i.GetDistanceFrom(start);
+  m_metric = i.ReadLsbtohU32 ();
+  return i.GetDistanceFrom (start);
 }
-void 
+void
 IeLinkMetricReport::PrintInformation (std::ostream& os) const
 {
   os << "Metric = " << m_metric;
 }
-bool operator== (const IeLinkMetricReport & a, const IeLinkMetricReport & b)
+bool
+operator== (const IeLinkMetricReport & a, const IeLinkMetricReport & b)
 {
   return (a.m_metric == b.m_metric);
-};
+}
+;
 
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IeLinkMetricReport
-struct IeLinkMetricReportBist : public IeTest 
+struct IeLinkMetricReportBist : public IeTest
 {
-  IeLinkMetricReportBist () : IeTest ("Mesh/802.11s/IE/LINK_METRIC_REPORT") {}
-  virtual bool RunTests(); 
+  IeLinkMetricReportBist () :
+    IeTest ("Mesh/802.11s/IE/LINK_METRIC_REPORT")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IeLinkMetricReportBist g_IeLinkMetricReportBist;
 
-bool IeLinkMetricReportBist::RunTests ()
+bool
+IeLinkMetricReportBist::RunTests ()
 {
-  bool result(true);
-  
+  bool result (true);
+
   // create test information element
-  IeLinkMetricReport a(123456);
+  IeLinkMetricReport a (123456);
   result = result && TestRoundtripSerialization (a);
   return result;
 }
--- a/src/devices/mesh/dot11s/ie-dot11s-metric-report.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-metric-report.h	Wed Jul 22 14:52:42 2009 +0400
@@ -25,8 +25,10 @@
 #include "ns3/buffer.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \brief a IEEE 802.11s Mesh ID 7.3.2.88 of 802.11s draft 3.0
  *
--- a/src/devices/mesh/dot11s/ie-dot11s-peer-management.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-peer-management.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -19,26 +19,24 @@
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  */
 
-
 #include "ie-dot11s-peer-management.h"
 #include "ns3/assert.h"
 #include "ns3/test.h"
 #include "ns3/packet.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
-IePeerManagement::IePeerManagement ():
-    m_length (0),
-    m_subtype (PEER_OPEN),
-    m_localLinkId (0),
-    m_peerLinkId (0),
-    m_reasonCode (REASON11S_RESERVED)
-{}
+IePeerManagement::IePeerManagement () :
+  m_length (0), m_subtype (PEER_OPEN), m_localLinkId (0), m_peerLinkId (0), m_reasonCode (REASON11S_RESERVED)
+{
+}
 WifiElementId
 IePeerManagement::ElementId () const
 {
-  return IE11S_PEERING_MANAGEMENT;  
+  return IE11S_PEERING_MANAGEMENT;
 }
 void
 IePeerManagement::SetPeerOpen (uint16_t localLinkId)
@@ -124,7 +122,7 @@
 IePeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
-  m_subtype  = i.ReadU8 ();
+  m_subtype = i.ReadU8 ();
   m_length = length;
   if (m_subtype == PEER_OPEN)
     {
@@ -138,14 +136,14 @@
     {
       NS_ASSERT (length == 7);
     }
-  m_localLinkId  = i.ReadLsbtohU16 ();
+  m_localLinkId = i.ReadLsbtohU16 ();
   if (m_length > 3)
     {
       m_peerLinkId = i.ReadLsbtohU16 ();
     }
   if (m_length > 5)
     {
-      m_reasonCode = (PmpReasonCode)i.ReadLsbtohU16 ();
+      m_reasonCode = (PmpReasonCode) i.ReadLsbtohU16 ();
     }
   return i.GetDistanceFrom (start);
 }
@@ -153,50 +151,51 @@
 IePeerManagement::PrintInformation (std::ostream& os) const
 {
 
-  os << " Subtype:      = " << (uint16_t)m_subtype << "\n";
-  os << " Length:       = " << (uint16_t)m_length << "\n";
+  os << " Subtype:      = " << (uint16_t) m_subtype << "\n";
+  os << " Length:       = " << (uint16_t) m_length << "\n";
   os << " LocalLinkId:  = " << m_localLinkId << "\n";
   os << " PeerLinkId:   = " << m_peerLinkId << "\n";
   os << " ReasonCode:   = " << m_reasonCode << "\n";
 }
-bool operator== (const IePeerManagement & a, const IePeerManagement & b)
+bool
+operator== (const IePeerManagement & a, const IePeerManagement & b)
 {
-  return (
-      (a.m_length == b.m_length) &&
-      (a.m_subtype == b.m_subtype) &&
-      (a.m_localLinkId == b.m_localLinkId) &&
-      (a.m_peerLinkId == b.m_peerLinkId) &&
-      (a.m_reasonCode == b.m_reasonCode)
-      );
+  return ((a.m_length == b.m_length) && (a.m_subtype == b.m_subtype) && (a.m_localLinkId == b.m_localLinkId)
+      && (a.m_peerLinkId == b.m_peerLinkId) && (a.m_reasonCode == b.m_reasonCode));
 }
-#ifdef RUN_SELF_TESTS  
-struct IePeerManagementBist : public IeTest 
+#ifdef RUN_SELF_TESTS
+struct IePeerManagementBist : public IeTest
 {
-  IePeerManagementBist () : IeTest ("Mesh/802.11s/IE/PeerManagement") {}
-  virtual bool RunTests(); 
+  IePeerManagementBist () :
+    IeTest ("Mesh/802.11s/IE/PeerManagement")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IePeerManagementBist g_IePerrBist;
 
-bool IePeerManagementBist::RunTests ()
+bool
+IePeerManagementBist::RunTests ()
 {
-  bool result(true);
-  {
-    IePeerManagement a;
-    a.SetPeerOpen (1);
-    result = result && TestRoundtripSerialization (a);
-  }
-  {
-    IePeerManagement a;
-    a.SetPeerConfirm (1,2);
-    result = result && TestRoundtripSerialization (a);
-  }
-  {
-    IePeerManagement a;
-    a.SetPeerClose (1, 2, REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
-    result = result && TestRoundtripSerialization (a);
-  }
+  bool result (true);
+    {
+      IePeerManagement a;
+      a.SetPeerOpen (1);
+      result = result && TestRoundtripSerialization (a);
+    }
+    {
+      IePeerManagement a;
+      a.SetPeerConfirm (1, 2);
+      result = result && TestRoundtripSerialization (a);
+    }
+    {
+      IePeerManagement a;
+      a.SetPeerClose (1, 2, REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
+      result = result && TestRoundtripSerialization (a);
+    }
   return result;
 }
 #endif
--- a/src/devices/mesh/dot11s/ie-dot11s-peer-management.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-peer-management.h	Wed Jul 22 14:52:42 2009 +0400
@@ -19,20 +19,22 @@
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  */
 
-
 #ifndef MESH_PEER_MAN_ELEMENT
 #define MESH_PEER_MAN_ELEMENT
 
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
 /**
  * \ingroup dot11s
- * \brief Codes used by 802.11s Peer Management Protocol 
+ * \brief Codes used by 802.11s Peer Management Protocol
  */
-enum PmpReasonCode {
+enum PmpReasonCode
+{
   REASON11S_PEERING_CANCELLED = 2, // according to open80211s
   REASON11S_MESH_MAX_PEERS,
   REASON11S_MESH_CAPABILITY_POLICY_VIOLATION,
@@ -44,7 +46,7 @@
   REASON11S_MESH_INVALID_SECURITY_CAPABILITY,
   REASON11S_RESERVED,
 };
-  
+
 /**
  * \ingroup dot11s
  * \brief See 7.3.2.85 of draft 2.07
@@ -52,12 +54,13 @@
 class IePeerManagement : public WifiInformationElement
 {
 public:
-    IePeerManagement ();
-    enum Subtype {
-      PEER_OPEN    = 0,
-      PEER_CONFIRM,
-      PEER_CLOSE,
-    };
+  IePeerManagement ();
+  enum Subtype
+  {
+    PEER_OPEN = 0,
+    PEER_CONFIRM,
+    PEER_CLOSE,
+  };
   void   SetPeerOpen (uint16_t localLinkId);
   void   SetPeerClose (uint16_t localLinkID, uint16_t peerLinkId, PmpReasonCode reasonCode);
   void   SetPeerConfirm (uint16_t localLinkID, uint16_t peerLinkId);
@@ -76,13 +79,13 @@
   uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
   void PrintInformation (std::ostream& os) const;
 private:
-  uint8_t   m_length;
-  uint8_t   m_subtype;
-  uint16_t  m_localLinkId;
+  uint8_t m_length;
+  uint8_t m_subtype;
+  uint16_t m_localLinkId;
   /**
    * Present within confirm and may be present in close
    */
-  uint16_t  m_peerLinkId;
+  uint16_t m_peerLinkId;
   /**
    * Present only within close frame
    */
--- a/src/devices/mesh/dot11s/ie-dot11s-peering-protocol.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-peering-protocol.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,17 +18,18 @@
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ie-dot11s-peering-protocol.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 uint8_t
 IePeeringProtocol::GetInformationSize () const
 {
   return 1;
 }
-IePeeringProtocol::IePeeringProtocol ():
-  m_protocol(0)
+IePeeringProtocol::IePeeringProtocol () :
+  m_protocol (0)
 {
 }
 WifiElementId
@@ -41,12 +42,11 @@
 {
   i.WriteU8 (m_protocol);
 }
-
 uint8_t
 IePeeringProtocol::DeserializeInformation (Buffer::Iterator i, uint8_t length)
 {
   Buffer::Iterator start = i;
-  m_protocol  = i.ReadU8 ();
+  m_protocol = i.ReadU8 ();
   return i.GetDistanceFrom (start);
 }
 void
--- a/src/devices/mesh/dot11s/ie-dot11s-peering-protocol.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-peering-protocol.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,14 +18,15 @@
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef MESH_PERING_PROTOCOL_H
 #define MESH_PEERING_PROTOCOL_H
 
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 class IePeeringProtocol : public WifiInformationElement
 {
 public:
--- a/src/devices/mesh/dot11s/ie-dot11s-perr.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-perr.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,14 +18,15 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ie-dot11s-perr.h"
 #include "ns3/address-utils.h"
 #include "ns3/node.h"
 #include "ns3/packet.h"
 #include "ns3/test.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 IePerr::IePerr ()
 {
 }
@@ -43,8 +44,8 @@
   os << "Number of failed destinations: = " << m_addressUnits.size ();
   for (unsigned int j = 0; j < m_addressUnits.size (); j++)
     {
-      os << "Failed destination address: = "<< m_addressUnits[j].destination <<
-        ", sequence number = " << m_addressUnits[j].seqnum;
+      os << "Failed destination address: = " << m_addressUnits[j].destination << ", sequence number = "
+          << m_addressUnits[j].seqnum;
     }
   os << "\n";
 }
@@ -70,12 +71,12 @@
   Buffer::Iterator i = start;
   i.Next (1); //Mode flags is not used now
   uint8_t numOfDest = i.ReadU8 ();
-  NS_ASSERT ((2+10*numOfDest) == length);
+  NS_ASSERT ((2 + 10* numOfDest ) == length);
   length = 0; //to avoid compiler warning in optimized builds
   for (unsigned int j = 0; j < numOfDest; j++)
     {
       FailedDestination unit;
-      ReadFrom (i,unit.destination);
+      ReadFrom (i, unit.destination);
       unit.seqnum = i.ReadLsbtohU32 ();
       m_addressUnits.push_back (unit);
     }
@@ -85,21 +86,20 @@
 uint8_t
 IePerr::GetInformationSize () const
 {
-  uint8_t retval =
-     1 //ModeFlags
-    +1 //NumOfDests
-    +(6+4) * m_addressUnits.size ();
+  uint8_t retval = 1 //ModeFlags
+      + 1 //NumOfDests
+      + (6 + 4) * m_addressUnits.size ();
   return retval;
 }
 
 void
 IePerr::AddAddressUnit (FailedDestination unit)
 {
-  for (unsigned int i = 0; i < m_addressUnits.size (); i ++)
+  for (unsigned int i = 0; i < m_addressUnits.size (); i++)
     {
       if (m_addressUnits[i].destination == unit.destination)
         {
-        return;
+          return;
         }
     }
   if ((m_addressUnits.size () + 1) * 10 + 2 > 255)
@@ -121,7 +121,7 @@
 void
 IePerr::DeleteAddressUnit (Mac48Address address)
 {
-  for (std::vector<FailedDestination>::iterator i = m_addressUnits.begin (); i != m_addressUnits.end(); i ++)
+  for (std::vector<FailedDestination>::iterator i = m_addressUnits.begin (); i != m_addressUnits.end (); i++)
     {
       if (i->destination == address)
         {
@@ -135,59 +135,64 @@
 {
   m_addressUnits.clear ();
 }
-bool operator== (const IePerr & a, const IePerr & b)
+bool
+operator== (const IePerr & a, const IePerr & b)
 {
   if (a.m_addressUnits.size () != b.m_addressUnits.size ())
     {
       return false;
     }
-  for (unsigned int i = 0; i < a.m_addressUnits.size(); i ++)
-  {
-    if (a.m_addressUnits[i].destination != b.m_addressUnits[i].destination)
-      {
-        return false;
-      }
-    if (a.m_addressUnits[i].seqnum != b.m_addressUnits[i].seqnum)
-      {
-        return false;
-      }
-  }
+  for (unsigned int i = 0; i < a.m_addressUnits.size (); i++)
+    {
+      if (a.m_addressUnits[i].destination != b.m_addressUnits[i].destination)
+        {
+          return false;
+        }
+      if (a.m_addressUnits[i].seqnum != b.m_addressUnits[i].seqnum)
+        {
+          return false;
+        }
+    }
   return true;
 }
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IePreq
-struct IePerrBist : public IeTest 
-{
-  IePerrBist () : IeTest ("Mesh/802.11s/IE/PERR") {}
-  virtual bool RunTests(); 
-};
+struct IePerrBist : public IeTest
+  {
+    IePerrBist () :
+    IeTest ("Mesh/802.11s/IE/PERR")
+      {
+      }
+    virtual bool
+    RunTests ();
+  };
 
 /// Test instance
 static IePerrBist g_IePerrBist;
 
-bool IePerrBist::RunTests ()
-{
-  bool result(true);
-  // create test information element
-  IePerr a;
-  IePerr::FailedDestination dest;
-  dest.destination = Mac48Address("11:22:33:44:55:66");
-  dest.seqnum = 1;
-  a.AddAddressUnit(dest);
-  dest.destination = Mac48Address("10:20:30:40:50:60");
-  dest.seqnum = 2;
-  a.AddAddressUnit(dest);
-  dest.destination = Mac48Address("01:02:03:04:05:06");
-  dest.seqnum = 3;
-  a.AddAddressUnit(dest);
-  
-  result = result && TestRoundtripSerialization (a);
-  return result;
-}
+bool
+IePerrBist::RunTests ()
+  {
+    bool result (true);
+    // create test information element
+    IePerr a;
+    IePerr::FailedDestination dest;
+    dest.destination = Mac48Address ("11:22:33:44:55:66");
+    dest.seqnum = 1;
+    a.AddAddressUnit (dest);
+    dest.destination = Mac48Address ("10:20:30:40:50:60");
+    dest.seqnum = 2;
+    a.AddAddressUnit (dest);
+    dest.destination = Mac48Address ("01:02:03:04:05:06");
+    dest.seqnum = 3;
+    a.AddAddressUnit (dest);
+
+    result = result && TestRoundtripSerialization (a);
+    return result;
+  }
 
 #endif // RUN_SELF_TESTS
-
 } // namespace dot11s
 } //namespace ns3
 
--- a/src/devices/mesh/dot11s/ie-dot11s-perr.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-perr.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,15 +18,16 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef PERR_INFORMATION_ELEMENT_H
 #define PERR_INFORMATION_ELEMENT_H
 
 #include "ns3/mac48-address.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
  * \brief See 7.3.2.98 of 802.11s draft 2.07
@@ -50,10 +51,10 @@
   void ResetPerr ();
 private:
   WifiElementId ElementId () const;
-  void  SerializeInformation (Buffer::Iterator i) const;
-  uint8_t  DeserializeInformation (Buffer::Iterator start, uint8_t length);
+  void SerializeInformation (Buffer::Iterator i) const;
+  uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
   void PrintInformation (std::ostream& os) const;
-  uint8_t  GetInformationSize () const;
+  uint8_t GetInformationSize () const;
 private:
   std::vector<FailedDestination> m_addressUnits;
   friend bool operator== (const IePerr & a, const IePerr & b);
--- a/src/devices/mesh/dot11s/ie-dot11s-prep.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-prep.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,31 +18,26 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ie-dot11s-prep.h"
 #include "ns3/address-utils.h"
 #include "ns3/node.h"
 #include "ns3/assert.h"
 #include "ns3/test.h"
 #include "ns3/packet.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /********************************
  * IePrep
  *******************************/
 IePrep::~IePrep ()
 {
 }
-IePrep::IePrep ():
-    m_flags (0),
-    m_hopcount (0),
-    m_ttl (0),
-    m_destinationAddress (Mac48Address::GetBroadcast()),
-    m_destSeqNumber (0),
-    m_lifetime (0),
-    m_metric (0),
-    m_originatorAddress (Mac48Address::GetBroadcast()),
-    m_originatorSeqNumber (0)
+IePrep::IePrep () :
+  m_flags (0), m_hopcount (0), m_ttl (0), m_destinationAddress (Mac48Address::GetBroadcast ()),
+      m_destSeqNumber (0), m_lifetime (0), m_metric (0), m_originatorAddress (Mac48Address::GetBroadcast ()),
+      m_originatorSeqNumber (0)
 {
 }
 WifiElementId
@@ -143,16 +138,15 @@
 void
 IePrep::DecrementTtl ()
 {
-  m_ttl --;
+  m_ttl--;
 }
 
 void
 IePrep::IncrementMetric (uint32_t metric)
 {
-  m_metric +=metric;
+  m_metric += metric;
 }
 
-
 void
 IePrep::SerializeInformation (Buffer::Iterator i) const
 {
@@ -184,80 +178,74 @@
 uint8_t
 IePrep::GetInformationSize () const
 {
-  uint32_t retval =
-     1 //Flags
-    +1 //Hopcount
-    +1 //Ttl
-    +6 //Dest address
-    +4 //Dest seqno
-    +4 //Lifetime
-    +4 //metric
-    +6 //Originator address
-    +4; //Originator seqno
+  uint32_t retval = 1 //Flags
+      + 1 //Hopcount
+      + 1 //Ttl
+      + 6 //Dest address
+      + 4 //Dest seqno
+      + 4 //Lifetime
+      + 4 //metric
+      + 6 //Originator address
+      + 4; //Originator seqno
   return retval;
-};
+}
+;
 void
 IePrep::PrintInformation (std::ostream& os) const
 {
-  os<<"Flags:        = " << m_flags <<
-    "\nHopcount:     = " << m_hopcount <<
-    "\nTTL:          = " << m_ttl <<
-    "\nDestination:  = " << m_destinationAddress <<
-    "\nDest. seqnum: = " << m_destSeqNumber <<
-    "\nLifetime:     = " << m_lifetime <<
-    "\nMetric:       = " << m_metric <<
-    "\nOriginator:   = " << m_originatorAddress <<
-    "\nOrig. seqnum: = " << m_originatorSeqNumber << "\n";
+  os << "Flags:        = " << m_flags << "\nHopcount:     = " << m_hopcount << "\nTTL:          = " << m_ttl
+      << "\nDestination:  = " << m_destinationAddress << "\nDest. seqnum: = " << m_destSeqNumber
+      << "\nLifetime:     = " << m_lifetime << "\nMetric:       = " << m_metric << "\nOriginator:   = "
+      << m_originatorAddress << "\nOrig. seqnum: = " << m_originatorSeqNumber << "\n";
 }
-bool operator== (const IePrep & a, const IePrep & b)
+bool
+operator== (const IePrep & a, const IePrep & b)
 {
-  return (
-      (a.m_flags == b.m_flags) &&
-      (a.m_hopcount == b.m_hopcount) &&
-      (a.m_ttl == b.m_ttl) &&
-      (a.m_destinationAddress == b.m_destinationAddress) &&
-      (a.m_destSeqNumber == b.m_destSeqNumber) && 
-      (a.m_lifetime == b.m_lifetime) &&
-      (a.m_metric == b.m_metric) &&
-      (a.m_originatorAddress == b.m_originatorAddress) &&
-      (a.m_originatorSeqNumber == b.m_originatorSeqNumber)
-      );
+  return ((a.m_flags == b.m_flags) && (a.m_hopcount == b.m_hopcount) && (a.m_ttl == b.m_ttl)
+      && (a.m_destinationAddress == b.m_destinationAddress) && (a.m_destSeqNumber == b.m_destSeqNumber)
+      && (a.m_lifetime == b.m_lifetime) && (a.m_metric == b.m_metric) && (a.m_originatorAddress
+      == b.m_originatorAddress) && (a.m_originatorSeqNumber == b.m_originatorSeqNumber));
 }
 
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IePrep
-struct IePrepBist : public IeTest 
+struct IePrepBist : public IeTest
 {
-  IePrepBist () : IeTest ("Mesh/802.11s/IE/PREP") {};
-  virtual bool RunTests(); 
+  IePrepBist () :
+    IeTest ("Mesh/802.11s/IE/PREP")
+  {
+  }
+  ;
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IePrepBist g_IePrepBist;
 
-bool IePrepBist::RunTests ()
+bool
+IePrepBist::RunTests ()
 {
-  bool result(true);
-  
+  bool result (true);
+
   // create test information element
   IePrep a;
   a.SetFlags (12);
   a.SetHopcount (11);
   a.SetTtl (10);
-  a.SetDestinationAddress (Mac48Address("11:22:33:44:55:66"));
+  a.SetDestinationAddress (Mac48Address ("11:22:33:44:55:66"));
   a.SetDestinationSeqNumber (123);
   a.SetLifetime (5000);
   a.SetMetric (4321);
-  a.SetOriginatorAddress (Mac48Address("33:00:22:00:11:00"));
+  a.SetOriginatorAddress (Mac48Address ("33:00:22:00:11:00"));
   a.SetOriginatorSeqNumber (666);
-  
+
   result = result && TestRoundtripSerialization (a);
   return result;
 }
 
 #endif // RUN_SELF_TESTS
- 
 } // namespace dot11s
 } //namespace ns3
 
--- a/src/devices/mesh/dot11s/ie-dot11s-prep.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-prep.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,16 +18,16 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef WIFI_PREP_INFORMATION_ELEMENT_H
 #define WIFI_PREP_INFORMATION_ELEMENT_H
 
-
 #include "ns3/mac48-address.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
  * \brief See 7.3.2.97 of 802.11s draft 2.07
@@ -46,7 +46,7 @@
   void SetMetric (uint32_t metric);
   void SetOriginatorAddress (Mac48Address originator_address);
   void SetOriginatorSeqNumber (uint32_t originator_seq_number);
- 
+
   uint8_t GetFlags () const;
   uint8_t GetHopcount () const;
   uint32_t GetTtl () const;
@@ -77,7 +77,7 @@
   uint32_t m_originatorSeqNumber;
   friend bool operator== (const IePrep & a, const IePrep & b);
 };
-bool operator== (const IePrep & a, const IePrep & b); 
+bool operator== (const IePrep & a, const IePrep & b);
 } // namespace dot11s
 } //namespace ns3
 #endif
--- a/src/devices/mesh/dot11s/ie-dot11s-preq.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-preq.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ie-dot11s-preq.h"
 #include "ns3/address-utils.h"
 #include "ns3/node.h"
@@ -26,17 +25,15 @@
 #include "ns3/test.h"
 #include "ns3/packet.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /*************************
  * DestinationAddressUnit
  ************************/
-DestinationAddressUnit::DestinationAddressUnit ():
-  m_do (false),
-  m_rf (false),
-  m_usn (false),
-  m_destinationAddress (Mac48Address ()),
-  m_destSeqNumber (0)
+DestinationAddressUnit::DestinationAddressUnit () :
+  m_do (false), m_rf (false), m_usn (false), m_destinationAddress (Mac48Address ()), m_destSeqNumber (0)
 {
 }
 void
@@ -51,7 +48,7 @@
 DestinationAddressUnit::SetDestSeqNumber (uint32_t dest_seq_number)
 {
   m_destSeqNumber = dest_seq_number;
-  if(m_destSeqNumber != 0)
+  if (m_destSeqNumber != 0)
     m_usn = true;
 }
 void
@@ -91,20 +88,13 @@
 IePreq::~IePreq ()
 {
 }
-IePreq::IePreq ():
-    m_maxSize (32),
-    m_flags (0),
-    m_hopCount (0),
-    m_ttl (0),
-    m_preqId (0),
-    m_originatorAddress (Mac48Address::GetBroadcast()),
-    m_originatorSeqNumber (0),
-    m_lifetime (0),
-    m_metric (0),
-    m_destCount (0)
+IePreq::IePreq () :
+  m_maxSize (32), m_flags (0), m_hopCount (0), m_ttl (0), m_preqId (0), m_originatorAddress (
+      Mac48Address::GetBroadcast ()), m_originatorSeqNumber (0), m_lifetime (0), m_metric (0),
+      m_destCount (0)
 {
 }
-WifiElementId 
+WifiElementId
 IePreq::ElementId () const
 {
   return IE11S_PREQ;
@@ -112,13 +102,13 @@
 void
 IePreq::SetUnicastPreq ()
 {
-  m_flags |= 1<<1;
+  m_flags |= 1 << 1;
 }
 
 void
 IePreq::SetNeedNotPrep ()
 {
-  m_flags |= 1<<2;
+  m_flags |= 1 << 2;
 }
 //void
 //IePreq::SetFlags (uint8_t flags)
@@ -168,12 +158,12 @@
 bool
 IePreq::IsUnicastPreq () const
 {
-  return (m_flags & (1<<1));
+  return (m_flags & (1 << 1));
 }
 bool
 IePreq::IsNeedNotPrep () const
 {
-  return (m_flags & (1<<2));
+  return (m_flags & (1 << 2));
 }
 uint8_t
 IePreq::GetHopCount () const
@@ -219,13 +209,13 @@
 void
 IePreq::DecrementTtl ()
 {
-  m_ttl --;
-  m_hopCount ++;
+  m_ttl--;
+  m_hopCount++;
 }
 void
 IePreq::IncrementMetric (uint32_t metric)
 {
-  m_metric +=metric;
+  m_metric += metric;
 }
 void
 IePreq::SerializeInformation (Buffer::Iterator i) const
@@ -240,7 +230,8 @@
   i.WriteHtolsbU32 (m_metric);
   i.WriteU8 (m_destCount);
   int written = 0;
-  for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator j = m_destinations.begin (); j != m_destinations.end(); j++)
+  for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator j = m_destinations.begin (); j
+      != m_destinations.end (); j++)
     {
       uint8_t flags = 0;
       if ((*j)->IsDo ())
@@ -251,12 +242,12 @@
         {
           flags |= 1 << 1;
         }
-      if((*j)->IsUsn ())
+      if ((*j)->IsUsn ())
         {
           flags |= 1 << 2;
         }
       i.WriteU8 (flags);
-      WriteTo (i, (*j)->GetDestinationAddress());
+      WriteTo (i, (*j)->GetDestinationAddress ());
       i.WriteHtolsbU32 ((*j)->GetDestSeqNumber ());
       written++;
       if (written > m_maxSize)
@@ -278,7 +269,7 @@
   m_lifetime = i.ReadLsbtohU32 ();
   m_metric = i.ReadLsbtohU32 ();
   m_destCount = i.ReadU8 ();
-  for (int j = 0; j < m_destCount; j++ )
+  for (int j = 0; j < m_destCount; j++)
     {
       Ptr<DestinationAddressUnit> new_element = Create<DestinationAddressUnit> ();
       bool doFlag = false;
@@ -299,34 +290,33 @@
         }
       new_element->SetFlags (doFlag, rfFlag, usnFlag);
       Mac48Address addr;
-      ReadFrom (i,addr);
+      ReadFrom (i, addr);
       new_element->SetDestinationAddress (addr);
-      new_element->SetDestSeqNumber (i.ReadLsbtohU32());
+      new_element->SetDestSeqNumber (i.ReadLsbtohU32 ());
       m_destinations.push_back (new_element);
-      NS_ASSERT (28+j*11 < length);
+      NS_ASSERT (28 + j * 11 < length);
     }
   return i.GetDistanceFrom (start);
 }
 uint8_t
 IePreq::GetInformationSize () const
 {
-  uint8_t retval =
-     1 //Flags
-    +1 //Hopcount
-    +1 //TTL
-    +4 //PREQ ID
-    +6 //Source address (originator)
-    +4 //Originator seqno
-    +4 //Lifetime
-    +4 //metric
-    +1; //destination count
+  uint8_t retval = 1 //Flags
+      + 1 //Hopcount
+      + 1 //TTL
+      + 4 //PREQ ID
+      + 6 //Source address (originator)
+      + 4 //Originator seqno
+      + 4 //Lifetime
+      + 4 //metric
+      + 1; //destination count
   if (m_destCount > m_maxSize)
     {
-      retval += (m_maxSize*11);
+      retval += (m_maxSize * 11);
     }
   else
     {
-      retval += (m_destCount*11);
+      retval += (m_destCount * 11);
     }
   return retval;
 }
@@ -334,14 +324,14 @@
 IePreq::PrintInformation (std::ostream &os) const
 {
   os << " originator address  = " << m_originatorAddress << "\n";
-  os << " TTL                 = "  <<  (uint16_t)m_ttl << "\n";
-  os << " hop count           = "  <<  (uint16_t)m_hopCount << "\n";
+  os << " TTL                 = " << (uint16_t) m_ttl << "\n";
+  os << " hop count           = " << (uint16_t) m_hopCount << "\n";
   os << " metric              = " << m_metric << "\n";
   os << " seqno               = " << m_originatorSeqNumber << "\n";
   os << " lifetime            = " << m_lifetime << "\n";
-  os << " preq ID             = " <<m_preqId << "\n";
+  os << " preq ID             = " << m_preqId << "\n";
   os << " Destinations are:\n";
-  for (int j = 0; j < m_destCount; j++ )
+  for (int j = 0; j < m_destCount; j++)
     os << "    " << m_destinations[j]->GetDestinationAddress () << "\n";
 }
 std::vector<Ptr<DestinationAddressUnit> >
@@ -350,13 +340,11 @@
   return m_destinations;
 }
 void
-IePreq::AddDestinationAddressElement (
-  bool doFlag, bool rfFlag,
-  Mac48Address dest_address,
-  uint32_t dest_seq_number
-)
+IePreq::AddDestinationAddressElement (bool doFlag, bool rfFlag, Mac48Address dest_address,
+    uint32_t dest_seq_number)
 {
-  for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator i = m_destinations.begin (); i != m_destinations.end(); i++ )
+  for (std::vector<Ptr<DestinationAddressUnit> >::const_iterator i = m_destinations.begin (); i
+      != m_destinations.end (); i++)
     {
       if ((*i)->GetDestinationAddress () == dest_address)
         {
@@ -364,7 +352,7 @@
         }
     }
   //TODO: check overflow
-  Ptr<DestinationAddressUnit>new_element = Create<DestinationAddressUnit> ();
+  Ptr<DestinationAddressUnit> new_element = Create<DestinationAddressUnit> ();
   new_element->SetFlags (doFlag, rfFlag, false);
   new_element->SetDestinationAddress (dest_address);
   new_element->SetDestSeqNumber (dest_seq_number);
@@ -374,7 +362,8 @@
 void
 IePreq::DelDestinationAddressElement (Mac48Address dest_address)
 {
-  for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin (); i != m_destinations.end(); i++)
+  for (std::vector<Ptr<DestinationAddressUnit> >::iterator i = m_destinations.begin (); i
+      != m_destinations.end (); i++)
     {
       if ((*i)->GetDestinationAddress () == dest_address)
         {
@@ -388,53 +377,46 @@
 IePreq::ClearDestinationAddressElements ()
 {
   int i;
-  for (std::vector<Ptr<DestinationAddressUnit> >::iterator j = m_destinations.begin (); j != m_destinations.end(); j++)
+  for (std::vector<Ptr<DestinationAddressUnit> >::iterator j = m_destinations.begin (); j
+      != m_destinations.end (); j++)
     {
       (*j) = 0;
     }
-  for (i = 0; i < m_destCount; i ++)
+  for (i = 0; i < m_destCount; i++)
     {
       m_destinations.pop_back ();
     }
   m_destinations.clear ();
   m_destCount = 0;
 }
-bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b)
-{
-  return (a.m_do == b.m_do 
-      &&  a.m_rf == b.m_rf
-      &&  a.m_usn == b.m_usn
-      &&  a.m_destinationAddress == b.m_destinationAddress
-      &&  a.m_destSeqNumber == b.m_destSeqNumber
-    );
-}
-bool operator== (const IePreq & a, const IePreq & b)
+bool
+operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b)
 {
-  bool ok = ( a.m_flags == b.m_flags 
-    && a.m_hopCount == b.m_hopCount
-    && a.m_ttl == b.m_ttl
-    && a.m_preqId == b.m_preqId 
-    && a.m_originatorAddress == b.m_originatorAddress
-    && a.m_originatorSeqNumber == b.m_originatorSeqNumber
-    && a.m_lifetime == b.m_lifetime
-    && a.m_metric == b.m_metric
-    && a.m_destCount == b.m_destCount
-  );
-  
-  if (! ok)
+  return (a.m_do == b.m_do && a.m_rf == b.m_rf && a.m_usn == b.m_usn && a.m_destinationAddress
+      == b.m_destinationAddress && a.m_destSeqNumber == b.m_destSeqNumber);
+}
+bool
+operator== (const IePreq & a, const IePreq & b)
+{
+  bool ok = (a.m_flags == b.m_flags && a.m_hopCount == b.m_hopCount && a.m_ttl == b.m_ttl && a.m_preqId
+      == b.m_preqId && a.m_originatorAddress == b.m_originatorAddress && a.m_originatorSeqNumber
+      == b.m_originatorSeqNumber && a.m_lifetime == b.m_lifetime && a.m_metric == b.m_metric && a.m_destCount
+      == b.m_destCount);
+
+  if (!ok)
     {
       return false;
     }
-  if (a.m_destinations.size() != b.m_destinations.size())
+  if (a.m_destinations.size () != b.m_destinations.size ())
     {
       return false;
     }
-  for (size_t i = 0; i < a.m_destinations.size(); ++i)
+  for (size_t i = 0; i < a.m_destinations.size (); ++i)
     {
-      if (!( *(PeekPointer (a.m_destinations[i])) == *(PeekPointer (b.m_destinations[i]))))
-      {
-        return false;
-      }
+      if (!(*(PeekPointer (a.m_destinations[i])) == *(PeekPointer (b.m_destinations[i]))))
+        {
+          return false;
+        }
     }
   return true;
 }
@@ -445,11 +427,11 @@
     {
       return false;
     }
-  if(m_destinations[0]->GetDestinationAddress () == Mac48Address::GetBroadcast ())
+  if (m_destinations[0]->GetDestinationAddress () == Mac48Address::GetBroadcast ())
     {
       return false;
     }
-  if((GetInformationSize () + 11) > 255)
+  if ((GetInformationSize () + 11) > 255)
     {
       return false;
     }
@@ -463,36 +445,40 @@
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IePreq
-struct IePreqBist : public IeTest 
+struct IePreqBist : public IeTest
 {
-  IePreqBist () : IeTest ("Mesh/802.11s/IE/PREQ") {}
-  virtual bool RunTests(); 
+  IePreqBist () :
+    IeTest ("Mesh/802.11s/IE/PREQ")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IePreqBist g_IePreqBist;
 
-bool IePreqBist::RunTests ()
+bool
+IePreqBist::RunTests ()
 {
-  bool result(true);
-  
+  bool result (true);
+
   // create test information element
   IePreq a;
   a.SetHopcount (0);
   a.SetTTL (1);
   a.SetPreqID (2);
-  a.SetOriginatorAddress ( Mac48Address("11:22:33:44:55:66") );
+  a.SetOriginatorAddress (Mac48Address ("11:22:33:44:55:66"));
   a.SetOriginatorSeqNumber (3);
   a.SetLifetime (4);
-  a.AddDestinationAddressElement (false, false, Mac48Address("11:11:11:11:11:11"), 5);
-  a.AddDestinationAddressElement (false, false, Mac48Address("22:22:22:22:22:22"), 6);
+  a.AddDestinationAddressElement (false, false, Mac48Address ("11:11:11:11:11:11"), 5);
+  a.AddDestinationAddressElement (false, false, Mac48Address ("22:22:22:22:22:22"), 6);
 
   result = result && TestRoundtripSerialization (a);
   return result;
 }
 
 #endif // RUN_SELF_TESTS
-  
 } // namespace dot11s
 } //namespace ns3
 
--- a/src/devices/mesh/dot11s/ie-dot11s-preq.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-preq.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef WIFI_PREQ_INFORMATION_ELEMENT_H
 #define WIFI_PREQ_INFORMATION_ELEMENT_H
 
@@ -27,8 +26,10 @@
 #include "ns3/mac48-address.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
  * \brief Describes an address unit in PREQ information element
@@ -52,7 +53,7 @@
   bool m_usn;
   Mac48Address m_destinationAddress;
   uint32_t m_destSeqNumber;
-  
+
   friend bool operator== (const DestinationAddressUnit & a, const DestinationAddressUnit & b);
 };
 /**
@@ -142,7 +143,7 @@
   uint32_t m_metric;
   uint8_t  m_destCount;
   std::vector<Ptr<DestinationAddressUnit> >  m_destinations;
-  
+
   friend bool operator== (const IePreq & a, const IePreq & b);
 };
 
--- a/src/devices/mesh/dot11s/ie-dot11s-rann.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-rann.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -18,7 +18,6 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #include "ie-dot11s-rann.h"
 #include "ns3/assert.h"
 #include "ns3/address-utils.h"
@@ -26,19 +25,17 @@
 #include "ns3/packet.h"
 #include "ns3/test.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
 IeRann::~IeRann ()
 {
 }
-IeRann::IeRann ():
-    m_flags (0),
-    m_hopcount (0),
-    m_ttl (0),
-    m_originatorAddress (Mac48Address::GetBroadcast()),
-    m_destSeqNumber (0),
-    m_metric (0)
+IeRann::IeRann () :
+  m_flags (0), m_hopcount (0), m_ttl (0), m_originatorAddress (Mac48Address::GetBroadcast ()),
+      m_destSeqNumber (0), m_metric (0)
 {
 }
 WifiElementId
@@ -106,11 +103,11 @@
 void
 IeRann::DecrementTtl ()
 {
-  m_ttl --;
-  m_hopcount ++;
+  m_ttl--;
+  m_hopcount++;
 }
 
-void 
+void
 IeRann::IncrementMetric (uint32_t m)
 {
   m_metric += m;
@@ -146,74 +143,74 @@
 uint8_t
 IeRann::GetInformationSize () const
 {
-  uint8_t retval =
-     1 //Flags
-    +1 //Hopcount
-    +1 //TTL
-    +6 //OriginatorAddress
-    +4 //DestSeqNumber
-    +4;//Metric
+  uint8_t retval = 1 //Flags
+      + 1 //Hopcount
+      + 1 //TTL
+      + 6 //OriginatorAddress
+      + 4 //DestSeqNumber
+      + 4;//Metric
   return retval;
 }
 
-void 
+void
 IeRann::PrintInformation (std::ostream &os) const
 {
-  os << "  flags              = " << (int)m_flags       << "\n";
-  os << "  hop count          = " << (int)m_hopcount    << "\n";
-  os << "  TTL                = " << (int)m_ttl         << "\n";
-  os << "  originator address = " << m_originatorAddress<< "\n";
-  os << "  dst seq. number    = " << m_destSeqNumber    << "\n";
-  os << "  metric             = " << m_metric           << "\n";
+  os << "  flags              = " << (int) m_flags << "\n";
+  os << "  hop count          = " << (int) m_hopcount << "\n";
+  os << "  TTL                = " << (int) m_ttl << "\n";
+  os << "  originator address = " << m_originatorAddress << "\n";
+  os << "  dst seq. number    = " << m_destSeqNumber << "\n";
+  os << "  metric             = " << m_metric << "\n";
 }
 
 bool
 operator== (const IeRann & a, const IeRann & b)
 {
-  return (a.m_flags == b.m_flags 
-      &&  a.m_hopcount == b.m_hopcount 
-      &&  a.m_ttl == b.m_ttl
-      &&  a.m_originatorAddress == b.m_originatorAddress
-      &&  a.m_destSeqNumber == b.m_destSeqNumber
-      &&  a.m_metric == b.m_metric 
-      );
+  return (a.m_flags == b.m_flags && a.m_hopcount == b.m_hopcount && a.m_ttl == b.m_ttl
+      && a.m_originatorAddress == b.m_originatorAddress && a.m_destSeqNumber == b.m_destSeqNumber
+      && a.m_metric == b.m_metric);
 }
-  
+
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for IeRann
 struct IeRannBist : public IeTest
 {
-  IeRannBist () : IeTest ("Mesh/802.11s/IE/RANN") {}
-  virtual bool RunTests(); 
+  IeRannBist () :
+    IeTest ("Mesh/802.11s/IE/RANN")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static IeRannBist g_IeRannBist;
 
-bool IeRannBist::RunTests ()
+bool
+IeRannBist::RunTests ()
 {
-  bool result(true);
-  
+  bool result (true);
+
   // create test information element
   IeRann a;
-  
+
   a.SetFlags (1);
   a.SetHopcount (2);
   a.SetTTL (4);
   a.DecrementTtl ();
-  NS_TEST_ASSERT_EQUAL (a.GetTtl(), 3);
+  NS_TEST_ASSERT_EQUAL (a.GetTtl (), 3);
   a.SetOriginatorAddress (Mac48Address ("11:22:33:44:55:66"));
   a.SetDestSeqNumber (5);
   a.SetMetric (6);
   a.IncrementMetric (2);
-  NS_TEST_ASSERT_EQUAL (a.GetMetric(), 8);
-  
+  NS_TEST_ASSERT_EQUAL (a.GetMetric (), 8);
+
   result = result && TestRoundtripSerialization (a);
   return result;
 }
 #endif // RUN_SELF_TESTS
-
-}} // namespace ns3::dot11s
+}
+} // namespace ns3::dot11s
 
 
--- a/src/devices/mesh/dot11s/ie-dot11s-rann.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/ie-dot11s-rann.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,15 +18,16 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef RANN_INFORMATION_ELEMENT_H
 #define RANN_INFORMATION_ELEMENT_H
 
 #include "ns3/mac48-address.h"
 #include "ns3/wifi-information-element.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
  * \brief See 7.3.2.95 of 802.11s draft 2.07
@@ -50,21 +51,21 @@
   uint32_t GetMetric ();
   void DecrementTtl ();
   void IncrementMetric (uint32_t metric);
-    
+
 private:
   WifiElementId ElementId () const;
   void SerializeInformation (Buffer::Iterator i) const;
   uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length);
   uint8_t GetInformationSize () const;
   void PrintInformation (std::ostream &os) const;
-  
+
   uint8_t m_flags;
   uint8_t m_hopcount;
   uint8_t m_ttl;
   Mac48Address m_originatorAddress;
   uint32_t m_destSeqNumber;
   uint32_t m_metric;
-  
+
   friend bool operator== (const IeRann & a, const IeRann & b);
 };
 
--- a/src/devices/mesh/dot11s/peer-link-frame.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link-frame.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
@@ -24,42 +24,51 @@
 #include "ns3/test.h"
 #include "ns3/packet.h"
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 NS_OBJECT_ENSURE_REGISTERED (PeerLinkFrameStart);
 
-PeerLinkFrameStart::PeerLinkFrameStart ():
-  m_subtype (255),
-  m_capability (0),
-  m_aid (0),
-  m_rates (SupportedRates()),
-  m_meshId (IeMeshId()),
-  m_config(IeConfiguration ()),
-  m_reasonCode ((uint16_t)REASON11S_RESERVED)
+PeerLinkFrameStart::PeerLinkFrameStart () :
+  m_subtype (255), m_capability (0), m_aid (0), m_rates (SupportedRates ()), m_meshId (IeMeshId ()),
+      m_config (IeConfiguration ()), m_reasonCode ((uint16_t) REASON11S_RESERVED)
 {
 }
 void
-PeerLinkFrameStart::SetPlinkFrameSubtype(uint8_t subtype)
+PeerLinkFrameStart::SetPlinkFrameSubtype (uint8_t subtype)
 {
   m_subtype = subtype;
 }
 void
-PeerLinkFrameStart::SetPlinkFrameStart(PeerLinkFrameStart::PlinkFrameStartFields fields)
+PeerLinkFrameStart::SetPlinkFrameStart (PeerLinkFrameStart::PlinkFrameStartFields fields)
 {
   m_subtype = fields.subtype;
   m_protocol = fields.protocol;
-  if(m_subtype != (uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE))
-    m_capability = fields.capability;
-  if(m_subtype == (uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM))
-    m_aid = fields.aid;
-  if(m_subtype != (uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE))
-    m_rates = fields.rates;
-  if(m_subtype != (uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM))
-    m_meshId = fields.meshId;
-  if(m_subtype != (uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE))
-    m_config = fields.config;
+  if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE))
+    {
+      m_capability = fields.capability;
+    }
+  if (m_subtype == (uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM))
+    {
+      m_aid = fields.aid;
+    }
+  if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE))
+    {
+      m_rates = fields.rates;
+    }
+  if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM))
+    {
+      m_meshId = fields.meshId;
+    }
+  if (m_subtype != (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE))
+    {
+      m_config = fields.config;
+    }
   else
-    m_reasonCode = fields.reasonCode;
+    {
+      m_reasonCode = fields.reasonCode;
+    }
 }
 PeerLinkFrameStart::PlinkFrameStartFields
 PeerLinkFrameStart::GetFields ()
@@ -78,11 +87,8 @@
 TypeId
 PeerLinkFrameStart::GetTypeId ()
 {
-  static TypeId tid =
-    TypeId ("ns3::dot11s::PeerLinkFrameStart")
-    .SetParent<Header> ()
-    .AddConstructor<PeerLinkFrameStart> ()
-    ;
+  static TypeId tid = TypeId ("ns3::dot11s::PeerLinkFrameStart") .SetParent<Header> () .AddConstructor<
+      PeerLinkFrameStart> ();
   return tid;
 }
 TypeId
@@ -93,159 +99,184 @@
 void
 PeerLinkFrameStart::Print (std::ostream &os) const
 {
-  os << "subtype = " << (uint16_t)m_subtype
-  << "\ncapability = " << m_capability
-  << "\naid = " << (uint16_t)m_aid
-  << "\nrates = " << m_rates
-  << "\nmeshId = " << m_meshId
-  << "\nconfiguration = " << m_config
-  << "\nreason code = " << m_reasonCode;
+  os << "subtype = " << (uint16_t) m_subtype << "\ncapability = " << m_capability << "\naid = "
+      << (uint16_t) m_aid << "\nrates = " << m_rates << "\nmeshId = " << m_meshId << "\nconfiguration = "
+      << m_config << "\nreason code = " << m_reasonCode;
 }
 uint32_t
 PeerLinkFrameStart::GetSerializedSize () const
 {
   uint32_t size = 3; //Peering protocol
-  NS_ASSERT(m_subtype < 3);
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    size += 2;  //capability
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
-    size += 2; //AID of remote peer
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    size += m_rates.GetSerializedSize ();
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
-    size += m_meshId.GetSerializedSize ();
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    size += m_config.GetSerializedSize ();
+  NS_ASSERT (m_subtype < 3);
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      size += 2; //capability
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
+    {
+      size += 2; //AID of remote peer
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      size += m_rates.GetSerializedSize ();
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
+    {
+      size += m_meshId.GetSerializedSize ();
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      size += m_config.GetSerializedSize ();
+    }
   else
-    size += 2; //reasonCode
+    {
+      size += 2; //reasonCode
+    }
   return size;
 }
 void
 PeerLinkFrameStart::Serialize (Buffer::Iterator start) const
 {
   Buffer::Iterator i = start;
-  NS_ASSERT(m_subtype < 3);
+  NS_ASSERT (m_subtype < 3);
   m_protocol.Serialize (i);
   i.Next (m_protocol.GetSerializedSize ());
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    i.WriteHtolsbU16 (m_capability);
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
-    i.WriteHtolsbU16 (m_aid);
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    i = m_rates.Serialize (i);
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
-  {
-    m_meshId.Serialize (i);
-    i.Next(m_meshId.GetSerializedSize ());
-  }
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-  {
-    m_config.Serialize (i);
-    i.Next(m_config.GetSerializedSize ());
-  }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      i.WriteHtolsbU16 (m_capability);
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
+    {
+      i.WriteHtolsbU16 (m_aid);
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      i = m_rates.Serialize (i);
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
+    {
+      m_meshId.Serialize (i);
+      i.Next (m_meshId.GetSerializedSize ());
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      m_config.Serialize (i);
+      i.Next (m_config.GetSerializedSize ());
+    }
   else
-    i.WriteHtolsbU16(m_reasonCode);
+    {
+      i.WriteHtolsbU16 (m_reasonCode);
+    }
 }
 uint32_t
 PeerLinkFrameStart::Deserialize (Buffer::Iterator start)
 {
   Buffer::Iterator i = start;
-  NS_ASSERT(m_subtype < 3);
+  NS_ASSERT (m_subtype < 3);
   m_protocol.Deserialize (i);
   i.Next (m_protocol.GetSerializedSize ());
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    m_capability = i.ReadLsbtohU16();
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
-    m_aid = i.ReadLsbtohU16 ();
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-    i = m_rates.Deserialize (i);
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
-  {
-    m_meshId.Deserialize (i);
-    i.Next(m_meshId.GetSerializedSize ());
-  }
-  if ((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
-  {
-    m_config.Deserialize (i);
-    i.Next (m_config.GetSerializedSize ());
-  }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      m_capability = i.ReadLsbtohU16 ();
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) == m_subtype)
+    {
+      m_aid = i.ReadLsbtohU16 ();
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      i = m_rates.Deserialize (i);
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM) != m_subtype)
+    {
+      m_meshId.Deserialize (i);
+      i.Next (m_meshId.GetSerializedSize ());
+    }
+  if ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE) != m_subtype)
+    {
+      m_config.Deserialize (i);
+      i.Next (m_config.GetSerializedSize ());
+    }
   else
-    m_reasonCode = i.ReadLsbtohU16();
+    {
+      m_reasonCode = i.ReadLsbtohU16 ();
+    }
   return i.GetDistanceFrom (start);
 }
-bool operator== (const PeerLinkFrameStart & a, const PeerLinkFrameStart & b)
+bool
+operator== (const PeerLinkFrameStart & a, const PeerLinkFrameStart & b)
 {
-  return (
-      (a.m_subtype == b.m_subtype) &&
-      (a.m_capability == b.m_capability) &&
-      (a.m_aid == b.m_aid) &&
-      (a.m_meshId.IsEqual(b.m_meshId)) &&
-      (a.m_config == b.m_config) &&
-      (a.m_reasonCode == b.m_reasonCode)
-      );
+  return ((a.m_subtype == b.m_subtype) && (a.m_capability == b.m_capability) && (a.m_aid == b.m_aid)
+      && (a.m_meshId.IsEqual (b.m_meshId)) && (a.m_config == b.m_config)
+      && (a.m_reasonCode == b.m_reasonCode));
 }
 #ifdef RUN_SELF_TESTS
 /// Built-in self test for PeerLinkFrameStart
-struct PeerLinkFrameStartBist : public Test 
+struct PeerLinkFrameStartBist : public Test
 {
-  PeerLinkFrameStartBist () : Test ("Mesh/802.11s/IE/PeerLinkFrameStart") {}
-  virtual bool RunTests(); 
+  PeerLinkFrameStartBist () :
+    Test ("Mesh/802.11s/IE/PeerLinkFrameStart")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 /// Test instance
 static PeerLinkFrameStartBist g_PeerLinkFrameStartBist;
 
-bool PeerLinkFrameStartBist::RunTests ()
+bool
+PeerLinkFrameStartBist::RunTests ()
 {
   bool result (true);
-  {
-    PeerLinkFrameStart a;
-    PeerLinkFrameStart::PlinkFrameStartFields fields;
-    fields.subtype = (uint8_t)(WifiMeshActionHeader::PEER_LINK_OPEN);
-    fields.capability = 0;
-    fields.aid = 101;
-    fields.reasonCode = 12;
-    fields.meshId = IeMeshId("qwertyuiop");
-    a.SetPlinkFrameStart(fields);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    PeerLinkFrameStart b;
-    b.SetPlinkFrameSubtype((uint8_t)(WifiMeshActionHeader::PEER_LINK_OPEN));
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (a, b);
-  }
-  {
-    PeerLinkFrameStart a;
-    PeerLinkFrameStart::PlinkFrameStartFields fields;
-    fields.subtype = (uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM);
-    fields.capability = 0;
-    fields.aid = 1234;
-    fields.reasonCode = 12;
-    fields.meshId = IeMeshId("qwerty");
-    a.SetPlinkFrameStart(fields);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    PeerLinkFrameStart b;
-    b.SetPlinkFrameSubtype((uint8_t)(WifiMeshActionHeader::PEER_LINK_CONFIRM));
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (a, b);
-  }
-  {
-    PeerLinkFrameStart a;
-    PeerLinkFrameStart::PlinkFrameStartFields fields;
-    fields.subtype = (uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE);
-    fields.capability = 0;
-    fields.aid = 10;
-    fields.meshId = IeMeshId("qqq");
-    fields.reasonCode = 12;
-    a.SetPlinkFrameStart(fields);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    PeerLinkFrameStart b;
-    b.SetPlinkFrameSubtype((uint8_t)(WifiMeshActionHeader::PEER_LINK_CLOSE));
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (a, b);
-  }
-  return result;  
+    {
+      PeerLinkFrameStart a;
+      PeerLinkFrameStart::PlinkFrameStartFields fields;
+      fields.subtype = (uint8_t) (WifiMeshActionHeader::PEER_LINK_OPEN);
+      fields.capability = 0;
+      fields.aid = 101;
+      fields.reasonCode = 12;
+      fields.meshId = IeMeshId ("qwertyuiop");
+      a.SetPlinkFrameStart (fields);
+      Ptr<Packet> packet = Create<Packet> ();
+      packet->AddHeader (a);
+      PeerLinkFrameStart b;
+      b.SetPlinkFrameSubtype ((uint8_t) (WifiMeshActionHeader::PEER_LINK_OPEN));
+      packet->RemoveHeader (b);
+      NS_TEST_ASSERT_EQUAL (a, b);
+    }
+    {
+      PeerLinkFrameStart a;
+      PeerLinkFrameStart::PlinkFrameStartFields fields;
+      fields.subtype = (uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM);
+      fields.capability = 0;
+      fields.aid = 1234;
+      fields.reasonCode = 12;
+      fields.meshId = IeMeshId ("qwerty");
+      a.SetPlinkFrameStart (fields);
+      Ptr<Packet> packet = Create<Packet> ();
+      packet->AddHeader (a);
+      PeerLinkFrameStart b;
+      b.SetPlinkFrameSubtype ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CONFIRM));
+      packet->RemoveHeader (b);
+      NS_TEST_ASSERT_EQUAL (a, b);
+    }
+    {
+      PeerLinkFrameStart a;
+      PeerLinkFrameStart::PlinkFrameStartFields fields;
+      fields.subtype = (uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE);
+      fields.capability = 0;
+      fields.aid = 10;
+      fields.meshId = IeMeshId ("qqq");
+      fields.reasonCode = 12;
+      a.SetPlinkFrameStart (fields);
+      Ptr<Packet> packet = Create<Packet> ();
+      packet->AddHeader (a);
+      PeerLinkFrameStart b;
+      b.SetPlinkFrameSubtype ((uint8_t) (WifiMeshActionHeader::PEER_LINK_CLOSE));
+      packet->RemoveHeader (b);
+      NS_TEST_ASSERT_EQUAL (a, b);
+    }
+  return result;
 }
 #endif
 } // namespace dot11s
--- a/src/devices/mesh/dot11s/peer-link-frame.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link-frame.h	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
@@ -26,12 +26,14 @@
 #include "ie-dot11s-configuration.h"
 #include "ie-dot11s-peering-protocol.h"
 #include "ie-dot11s-id.h"
-namespace ns3 {
+namespace ns3
+{
 class MeshWifiInterfaceMac;
-namespace dot11s {
+namespace dot11s
+{
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief 802.11s Peer link management frame:
  * \details included the following (see chapters 7.4.12.1-7.4.12.3 of
  * 802.11s):
--- a/src/devices/mesh/dot11s/peer-link.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  *          Pavel Boyko <boyko@iitp.ru>
@@ -27,55 +27,65 @@
 
 NS_LOG_COMPONENT_DEFINE ("Dot11sPeerManagementProtocol");
 
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 
-NS_OBJECT_ENSURE_REGISTERED(PeerLink);
+NS_OBJECT_ENSURE_REGISTERED( PeerLink);
 
-TypeId 
-PeerLink::GetTypeId()
+TypeId
+PeerLink::GetTypeId ()
 {
   static TypeId tid = TypeId ("ns3::dot11s::PeerLink")
     .SetParent<Object> ()
     .AddConstructor<PeerLink> ()
-    .AddAttribute ("RetryTimeout", "Retry timeout",
-        TimeValue (TimeValue (MicroSeconds (40 * 1024))),
-        MakeTimeAccessor (&PeerLink::m_dot11MeshRetryTimeout),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("HoldingTimeout", "Holding timeout",
-        TimeValue (TimeValue (MicroSeconds (40 * 1024))),
-        MakeTimeAccessor (&PeerLink::m_dot11MeshHoldingTimeout),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("ConfirmTimeout", "Confirm timeout",
-        TimeValue (TimeValue (MicroSeconds (40 * 1024))),
-        MakeTimeAccessor (&PeerLink::m_dot11MeshConfirmTimeout),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("MaxRetries", "Maximum number of retries",
-        UintegerValue (4),
-        MakeUintegerAccessor (&PeerLink::m_dot11MeshMaxRetries),
-        MakeUintegerChecker<uint16_t> ()
-        )
-    .AddAttribute ("MaxBeaconLoss", "Maximum number of lost beacons before link will be closed",
-        UintegerValue (2),
-        MakeUintegerAccessor (&PeerLink::m_maxBeaconLoss),
-        MakeUintegerChecker<uint16_t> (1)
-        );
+    .AddAttribute ( "RetryTimeout",
+                    "Retry timeout",
+                    TimeValue (TimeValue (MicroSeconds (40 * 1024))),
+                    MakeTimeAccessor (
+                        &PeerLink::m_dot11MeshRetryTimeout),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "HoldingTimeout",
+                    "Holding timeout",
+                    TimeValue (TimeValue (MicroSeconds (40 * 1024))),
+                    MakeTimeAccessor (
+                        &PeerLink::m_dot11MeshHoldingTimeout),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "ConfirmTimeout",
+                    "Confirm timeout",
+                    TimeValue (TimeValue (MicroSeconds (40 * 1024))),
+                    MakeTimeAccessor (
+                        &PeerLink::m_dot11MeshConfirmTimeout),
+                    MakeTimeChecker ()
+                  )
+    .AddAttribute ( "MaxRetries",
+                    "Maximum number of retries",
+                    UintegerValue (4),
+                    MakeUintegerAccessor (
+                        &PeerLink::m_dot11MeshMaxRetries),
+                    MakeUintegerChecker<uint16_t> ()
+                  )
+    .AddAttribute ( "MaxBeaconLoss",
+                    "Maximum number of lost beacons before link will be closed",
+                    UintegerValue (2),
+                    MakeUintegerAccessor (
+                        &PeerLink::m_maxBeaconLoss),
+                    MakeUintegerChecker<uint16_t> (1)
+                  )
+                  ;
   return tid;
 }
-  
+
+
 //-----------------------------------------------------------------------------
 // PeerLink public interface
 //-----------------------------------------------------------------------------
-PeerLink::PeerLink ():
-  m_peerAddress (Mac48Address::GetBroadcast ()),
-  m_peerMeshPointAddress (Mac48Address::GetBroadcast ()),
-  m_localLinkId (0),
-  m_peerLinkId (0),
-  m_state (IDLE),
-  m_retryCounter (0)
+PeerLink::PeerLink () :
+  m_peerAddress (Mac48Address::GetBroadcast ()), m_peerMeshPointAddress (Mac48Address::GetBroadcast ()),
+      m_localLinkId (0), m_peerLinkId (0), m_state (IDLE), m_retryCounter (0)
 {
 }
 PeerLink::~PeerLink ()
@@ -96,7 +106,7 @@
   m_peerAddress = macaddr;
 }
 void
-PeerLink::SetPeerMeshPointAddress(Mac48Address macaddr)
+PeerLink::SetPeerMeshPointAddress (Mac48Address macaddr)
 {
   m_peerMeshPointAddress = macaddr;
 }
@@ -121,8 +131,8 @@
   m_lastBeacon = lastBeacon;
   m_beaconInterval = beaconInterval;
   m_beaconLossTimer.Cancel ();
-  Time delay = Seconds(beaconInterval.GetSeconds() * m_maxBeaconLoss);
-  NS_ASSERT (delay.GetMicroSeconds() != 0);
+  Time delay = Seconds (beaconInterval.GetSeconds () * m_maxBeaconLoss);
+  NS_ASSERT (delay.GetMicroSeconds () != 0);
   m_beaconLossTimer = Simulator::Schedule (delay, &PeerLink::BeaconLoss, this);
 }
 void
@@ -168,7 +178,7 @@
 void
 PeerLink::MLMECancelPeerLink (PmpReasonCode reason)
 {
-  StateMachine (CNCL,reason);
+  StateMachine (CNCL, reason);
 }
 void
 PeerLink::MLMEActivePeerLinkOpen ()
@@ -191,7 +201,7 @@
     {
       m_peerLinkId = localLinkId;
     }
-  else 
+  else
     {
       if (m_peerLinkId != localLinkId)
         {
@@ -201,7 +211,7 @@
   StateMachine (CLS_ACPT, reason);
 }
 void
-PeerLink::OpenAccept (uint16_t localLinkId, IeConfiguration  conf, Mac48Address peerMp)
+PeerLink::OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp)
 {
   if (m_peerLinkId == 0)
     {
@@ -210,7 +220,7 @@
   m_configuration = conf;
   if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ())
     {
-      NS_ASSERT(m_peerMeshPointAddress == peerMp);
+      NS_ASSERT (m_peerMeshPointAddress == peerMp);
     }
   else
     {
@@ -219,16 +229,16 @@
   StateMachine (OPN_ACPT);
 }
 void
-PeerLink::OpenReject (uint16_t localLinkId, IeConfiguration  conf, Mac48Address peerMp, PmpReasonCode reason)
+PeerLink::OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason)
 {
-  if ( m_peerLinkId == 0)
+  if (m_peerLinkId == 0)
     {
       m_peerLinkId = localLinkId;
     }
   m_configuration = conf;
   if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ())
     {
-      NS_ASSERT(m_peerMeshPointAddress == peerMp);
+      NS_ASSERT (m_peerMeshPointAddress == peerMp);
     }
   else
     {
@@ -237,19 +247,20 @@
   StateMachine (OPN_RJCT, reason);
 }
 void
-PeerLink::ConfirmAccept (uint16_t localLinkId, uint16_t peerLinkId, uint16_t peerAid, IeConfiguration conf, Mac48Address peerMp)
+PeerLink::ConfirmAccept (uint16_t localLinkId, uint16_t peerLinkId, uint16_t peerAid, IeConfiguration conf,
+    Mac48Address peerMp)
 {
-  if ( m_localLinkId != peerLinkId)
+  if (m_localLinkId != peerLinkId)
     {
       return;
     }
-  if ( m_peerLinkId == 0)
+  if (m_peerLinkId == 0)
     {
       m_peerLinkId = localLinkId;
     }
   else
     {
-      if ( m_peerLinkId != localLinkId )
+      if (m_peerLinkId != localLinkId)
         {
           return;
         }
@@ -257,16 +268,18 @@
   m_configuration = conf;
   m_peerAssocId = peerAid;
   if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ())
-  {
-    NS_ASSERT(m_peerMeshPointAddress == peerMp);
-  }
+    {
+      NS_ASSERT (m_peerMeshPointAddress == peerMp);
+    }
   else
-    m_peerMeshPointAddress = peerMp;
+    {
+      m_peerMeshPointAddress = peerMp;
+    }
   StateMachine (CNF_ACPT);
 }
 void
-PeerLink::ConfirmReject (uint16_t localLinkId, uint16_t peerLinkId,
-    IeConfiguration  conf, Mac48Address peerMp, PmpReasonCode reason)
+PeerLink::ConfirmReject (uint16_t localLinkId, uint16_t peerLinkId, IeConfiguration conf,
+    Mac48Address peerMp, PmpReasonCode reason)
 {
   if (m_localLinkId != peerLinkId)
     {
@@ -285,9 +298,9 @@
     }
   m_configuration = conf;
   if (m_peerMeshPointAddress != Mac48Address::GetBroadcast ())
-  {
-    NS_ASSERT(m_peerMeshPointAddress == peerMp);
-  }
+    {
+      NS_ASSERT (m_peerMeshPointAddress == peerMp);
+    }
   m_peerMeshPointAddress = peerMp;
   StateMachine (CNF_RJCT, reason);
 }
@@ -302,7 +315,7 @@
   return (m_state == IDLE);
 }
 void
-PeerLink::SetMacPlugin(Ptr<PeerManagementProtocolMac> plugin)
+PeerLink::SetMacPlugin (Ptr<PeerManagementProtocolMac> plugin)
 {
   m_macPlugin = plugin;
 }
@@ -310,249 +323,249 @@
 // Private
 //-----------------------------------------------------------------------------
 void
-PeerLink::StateMachine (PeerEvent event,PmpReasonCode reasoncode)
+PeerLink::StateMachine (PeerEvent event, PmpReasonCode reasoncode)
 {
   switch (m_state)
     {
-    case IDLE:
-      switch (event)
-        {
-        case CNCL:
-        case CLS_ACPT:
-          m_state = IDLE;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, IDLE, IDLE);
-          break;
-        case REQ_RJCT:
-          SendPeerLinkClose (reasoncode);
-          break;
-        case ACTOPN:
-          m_state = OPN_SNT;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, IDLE, OPN_SNT);
-          SendPeerLinkOpen ();
-          SetRetryTimer ();
-          break;
-        case OPN_ACPT:
-          m_state = OPN_RCVD;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, IDLE, OPN_RCVD);
-          SendPeerLinkConfirm ();
-          SendPeerLinkOpen ();
-          SetRetryTimer ();
-          break;
-        default:
-          //11B.5.3.4 of 802.11s Draft D3.0 
-          //All other events shall be ignored in this state
-          break;
-        }
+  case IDLE:
+    switch (event)
+      {
+    case CNCL:
+    case CLS_ACPT:
+      m_state = IDLE;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, IDLE, IDLE);
+      break;
+    case REQ_RJCT:
+      SendPeerLinkClose (reasoncode);
+      break;
+    case ACTOPN:
+      m_state = OPN_SNT;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, IDLE, OPN_SNT);
+      SendPeerLinkOpen ();
+      SetRetryTimer ();
+      break;
+    case OPN_ACPT:
+      m_state = OPN_RCVD;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, IDLE, OPN_RCVD);
+      SendPeerLinkConfirm ();
+      SendPeerLinkOpen ();
+      SetRetryTimer ();
+      break;
+    default:
+      //11B.5.3.4 of 802.11s Draft D3.0
+      //All other events shall be ignored in this state
+      break;
+      }
+    break;
+  case OPN_SNT:
+    switch (event)
+      {
+    case TOR1:
+      SendPeerLinkOpen ();
+      m_retryCounter++;
+      SetRetryTimer ();
+      break;
+    case CNF_ACPT:
+      m_state = CNF_RCVD;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, CNF_RCVD);
+      ClearRetryTimer ();
+      SetConfirmTimer ();
+      break;
+    case OPN_ACPT:
+      m_state = OPN_RCVD;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, OPN_RCVD);
+      SendPeerLinkConfirm ();
+      break;
+    case CLS_ACPT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+      SetHoldingTimer ();
       break;
-    case OPN_SNT:
-      switch (event)
-        {
-        case TOR1:
-          SendPeerLinkOpen ();
-          m_retryCounter++;
-          SetRetryTimer ();
-          break;
-        case CNF_ACPT:
-          m_state = CNF_RCVD;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, CNF_RCVD);
-          ClearRetryTimer ();
-          SetConfirmTimer ();
-          break;
-        case OPN_ACPT:
-          m_state = OPN_RCVD;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, OPN_RCVD);
-          SendPeerLinkConfirm ();
-          break;
-        case CLS_ACPT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
-          SetHoldingTimer ();
-          break;
-        case OPN_RJCT:
-        case CNF_RJCT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (reasoncode);
-          SetHoldingTimer ();
-          break;
-        case TOR2:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (REASON11S_MESH_MAX_RETRIES);
-          SetHoldingTimer ();
-          break;
-        case CNCL:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
-          SetHoldingTimer ();
-          break;
-        default:
-          //11B.5.3.5 of 802.11s Draft D3.0 
-          //All other events shall be ignored in this state
-          break;
-        }
+    case OPN_RJCT:
+    case CNF_RJCT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (reasoncode);
+      SetHoldingTimer ();
+      break;
+    case TOR2:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (REASON11S_MESH_MAX_RETRIES);
+      SetHoldingTimer ();
+      break;
+    case CNCL:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_SNT, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
+      SetHoldingTimer ();
+      break;
+    default:
+      //11B.5.3.5 of 802.11s Draft D3.0
+      //All other events shall be ignored in this state
+      break;
+      }
+    break;
+  case CNF_RCVD:
+    switch (event)
+      {
+    case CNF_ACPT:
+      break;
+    case OPN_ACPT:
+      m_state = ESTAB;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, ESTAB);
+      ClearConfirmTimer ();
+      SendPeerLinkConfirm ();
+      NS_ASSERT (m_peerMeshPointAddress != Mac48Address::GetBroadcast ());
+      break;
+    case CLS_ACPT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
+      ClearConfirmTimer ();
+      SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+      SetHoldingTimer ();
+      break;
+    case CNF_RJCT:
+    case OPN_RJCT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
+      ClearConfirmTimer ();
+      SendPeerLinkClose (reasoncode);
+      SetHoldingTimer ();
+      break;
+    case CNCL:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
+      ClearConfirmTimer ();
+      SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
+      SetHoldingTimer ();
       break;
-    case CNF_RCVD:
-      switch (event)
-        {
-        case CNF_ACPT:
-          break;
-        case OPN_ACPT:
-          m_state = ESTAB;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, ESTAB);
-          ClearConfirmTimer ();
-          SendPeerLinkConfirm ();
-          NS_ASSERT(m_peerMeshPointAddress != Mac48Address::GetBroadcast ());
-          break;
-        case CLS_ACPT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
-          ClearConfirmTimer ();
-          SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
-          SetHoldingTimer ();
-          break;
-        case CNF_RJCT:
-        case OPN_RJCT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
-          ClearConfirmTimer ();
-          SendPeerLinkClose (reasoncode);
-          SetHoldingTimer ();
-          break;
-        case CNCL:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
-          ClearConfirmTimer ();
-          SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
-          SetHoldingTimer ();
-          break;
-        case TOC:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
-          SendPeerLinkClose (REASON11S_MESH_CONFIRM_TIMEOUT);
-          SetHoldingTimer ();
-          break;
-        default:
-          //11B.5.3.6 of 802.11s Draft D3.0 
-          //All other events shall be ignored in this state
-          break;
-        }
+    case TOC:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, CNF_RCVD, HOLDING);
+      SendPeerLinkClose (REASON11S_MESH_CONFIRM_TIMEOUT);
+      SetHoldingTimer ();
+      break;
+    default:
+      //11B.5.3.6 of 802.11s Draft D3.0
+      //All other events shall be ignored in this state
+      break;
+      }
+    break;
+  case OPN_RCVD:
+    switch (event)
+      {
+    case TOR1:
+      SendPeerLinkOpen ();
+      m_retryCounter++;
+      SetRetryTimer ();
+      break;
+    case CNF_ACPT:
+      m_state = ESTAB;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, ESTAB);
+      ClearRetryTimer ();
+      NS_ASSERT (m_peerMeshPointAddress != Mac48Address::GetBroadcast ());
+      break;
+    case CLS_ACPT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+      SetHoldingTimer ();
+      break;
+    case OPN_RJCT:
+    case CNF_RJCT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (reasoncode);
+      SetHoldingTimer ();
+      break;
+    case TOR2:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (REASON11S_MESH_MAX_RETRIES);
+      SetHoldingTimer ();
+      break;
+    case CNCL:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
+      SetHoldingTimer ();
+      break;
+    default:
+      //11B.5.3.7 of 802.11s Draft D3.0
+      //All other events shall be ignored in this state
       break;
-    case OPN_RCVD:
-      switch (event)
-        {
-        case TOR1:
-          SendPeerLinkOpen ();
-          m_retryCounter++;
-          SetRetryTimer ();
-          break;
-        case CNF_ACPT:
-          m_state = ESTAB;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, ESTAB);
-          ClearRetryTimer ();
-          NS_ASSERT (m_peerMeshPointAddress != Mac48Address::GetBroadcast ());
-          break;
-        case CLS_ACPT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
-          SetHoldingTimer ();
-          break;
-        case OPN_RJCT:
-        case CNF_RJCT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (reasoncode);
-          SetHoldingTimer ();
-          break;
-        case TOR2:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (REASON11S_MESH_MAX_RETRIES);
-          SetHoldingTimer ();
-          break;
-        case CNCL:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, OPN_RCVD, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
-          SetHoldingTimer ();
-          break;
-        default:
-          //11B.5.3.7 of 802.11s Draft D3.0 
-          //All other events shall be ignored in this state
-          break;
-        }
+      }
+    break;
+  case ESTAB:
+    switch (event)
+      {
+    case OPN_ACPT:
+      SendPeerLinkConfirm ();
+      break;
+    case CLS_ACPT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, ESTAB, HOLDING);
+      SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
+      SetHoldingTimer ();
+      break;
+    case OPN_RJCT:
+    case CNF_RJCT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, ESTAB, HOLDING);
+      ClearRetryTimer ();
+      SendPeerLinkClose (reasoncode);
+      SetHoldingTimer ();
+      break;
+    case CNCL:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, ESTAB, HOLDING);
+      SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
+      SetHoldingTimer ();
       break;
-    case ESTAB:
-      switch (event)
-        {
-        case OPN_ACPT:
-          SendPeerLinkConfirm ();
-          break;
-        case CLS_ACPT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, ESTAB, HOLDING);
-          SendPeerLinkClose (REASON11S_MESH_CLOSE_RCVD);
-          SetHoldingTimer ();
-          break;
-        case OPN_RJCT:
-        case CNF_RJCT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, ESTAB, HOLDING);
-          ClearRetryTimer ();
-          SendPeerLinkClose (reasoncode);
-          SetHoldingTimer ();
-          break;
-        case CNCL:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, ESTAB, HOLDING);
-          SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
-          SetHoldingTimer ();
-          break;
-        default:
-          //11B.5.3.8 of 802.11s Draft D3.0 
-          //All other events shall be ignored in this state
-          break;
-        }
+    default:
+      //11B.5.3.8 of 802.11s Draft D3.0
+      //All other events shall be ignored in this state
+      break;
+      }
+    break;
+  case HOLDING:
+    switch (event)
+      {
+    case CLS_ACPT:
+      ClearHoldingTimer ();
+    case TOH:
+      m_state = IDLE;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, HOLDING, IDLE);
       break;
-    case HOLDING:
-      switch (event)
-        {
-        case CLS_ACPT:
-          ClearHoldingTimer ();
-        case TOH:
-          m_state = IDLE;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, HOLDING, IDLE);
-          break;
-        case OPN_ACPT:
-        case CNF_ACPT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, HOLDING, HOLDING);
-          // reason not spec in D2.0
-          SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
-          break;
-        case OPN_RJCT:
-        case CNF_RJCT:
-          m_state = HOLDING;
-          m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, HOLDING, HOLDING);
-          SendPeerLinkClose (reasoncode);
-          break;
-        default:
-          //11B.5.3.9 of 802.11s Draft D3.0 
-          //All other events shall be ignored in this state
-          break;
-        }
+    case OPN_ACPT:
+    case CNF_ACPT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, HOLDING, HOLDING);
+      // reason not spec in D2.0
+      SendPeerLinkClose (REASON11S_PEERING_CANCELLED);
       break;
+    case OPN_RJCT:
+    case CNF_RJCT:
+      m_state = HOLDING;
+      m_linkStatusCallback (m_interface, m_peerAddress, m_peerMeshPointAddress, HOLDING, HOLDING);
+      SendPeerLinkClose (reasoncode);
+      break;
+    default:
+      //11B.5.3.9 of 802.11s Draft D3.0
+      //All other events shall be ignored in this state
+      break;
+      }
+    break;
     }
 }
 void
@@ -575,7 +588,8 @@
 {
   IePeerManagement peerElement;
   peerElement.SetPeerClose (m_localLinkId, m_peerLinkId, reasoncode);
-  m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement, m_configuration);
+  m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement,
+      m_configuration);
 }
 void
 PeerLink::SendPeerLinkOpen ()
@@ -583,19 +597,21 @@
   IePeerManagement peerElement;
   peerElement.SetPeerOpen (m_localLinkId);
   NS_ASSERT (m_macPlugin != 0);
-  m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement, m_configuration);
+  m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement,
+      m_configuration);
 }
 void
 PeerLink::SendPeerLinkConfirm ()
 {
   IePeerManagement peerElement;
   peerElement.SetPeerConfirm (m_localLinkId, m_peerLinkId);
-  m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement, m_configuration);
+  m_macPlugin->SendPeerLinkManagementFrame (m_peerAddress, m_peerMeshPointAddress, m_assocId, peerElement,
+      m_configuration);
 }
 void
 PeerLink::SetHoldingTimer ()
 {
-  NS_ASSERT(m_dot11MeshHoldingTimeout.GetMicroSeconds() !=0);
+  NS_ASSERT (m_dot11MeshHoldingTimeout.GetMicroSeconds () != 0);
   m_holdingTimer = Simulator::Schedule (m_dot11MeshHoldingTimeout, &PeerLink::HoldingTimeout, this);
 }
 void
@@ -606,13 +622,13 @@
 void
 PeerLink::SetRetryTimer ()
 {
-  NS_ASSERT(m_dot11MeshRetryTimeout.GetMicroSeconds() !=0);
+  NS_ASSERT (m_dot11MeshRetryTimeout.GetMicroSeconds () != 0);
   m_retryTimer = Simulator::Schedule (m_dot11MeshRetryTimeout, &PeerLink::RetryTimeout, this);
 }
 void
 PeerLink::RetryTimeout ()
 {
-  if ( m_retryCounter < m_dot11MeshMaxRetries)
+  if (m_retryCounter < m_dot11MeshMaxRetries)
     {
       StateMachine (TOR1);
     }
@@ -624,7 +640,7 @@
 void
 PeerLink::SetConfirmTimer ()
 {
-  NS_ASSERT (m_dot11MeshConfirmTimeout.GetMicroSeconds() !=0);
+  NS_ASSERT (m_dot11MeshConfirmTimeout.GetMicroSeconds () != 0);
   m_confirmTimer = Simulator::Schedule (m_dot11MeshConfirmTimeout, &PeerLink::ConfirmTimeout, this);
 }
 void
@@ -637,13 +653,13 @@
 {
   if (m_state != ESTAB)
     {
-    return;
+      return;
     }
   os << "<PeerLink\n"
     "localAddress=\"" << m_macPlugin->GetAddress () << "\"\n"
     "peerInterfaceAddress=\"" << m_peerAddress << "\"\n"
     "peerMeshPointAddress=\"" << m_peerMeshPointAddress << "\"\n"
-    "metric=\"" << m_macPlugin->GetLinkMetric(m_peerAddress) << "\"\n"
+    "metric=\"" << m_macPlugin->GetLinkMetric (m_peerAddress) << "\"\n"
     "lastBeacon=\"" << m_lastBeacon.GetSeconds () << "\"\n"
     "localLinkId=\"" << m_localLinkId << "\"\n"
     "peerLinkId=\"" << m_peerLinkId << "\"\n"
--- a/src/devices/mesh/dot11s/peer-link.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link.h	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  */
@@ -30,12 +30,14 @@
 #include "ie-dot11s-peer-management.h"
 #include "ie-dot11s-configuration.h"
 #include "peer-management-protocol-mac.h"
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /**
  * \ingroup dot11s
- * 
- * \brief Peer link model for 802.11s Peer Management protocol 
+ *
+ * \brief Peer link model for 802.11s Peer Management protocol
  */
 class PeerLink : public Object
 {
@@ -47,12 +49,12 @@
   PeerLink ();
   ~PeerLink ();
   void DoDispose ();
-  
+
   /// Process beacon received from peer
   void SetBeaconInformation (Time lastBeacon, Time BeaconInterval);
   /**
    * \brief Method used to detecet peer link changes
-   * 
+   *
    * \param bool if true - opened new link, if false - link closed
    */
   void  SetLinkStatusCallback (Callback<void, uint32_t, Mac48Address, bool> cb);
@@ -76,7 +78,7 @@
   IeBeaconTiming GetBeaconTimingElement ()const;
   IePeerManagement GetPeerLinkDescriptorElement ()const;
   //\}
-  
+
   /**
    * \name MLME
    * \{
@@ -88,7 +90,7 @@
   /// MLME-PeeringRequestReject
   void MLMEPeeringRequestReject ();
   enum  PeerState {
-    IDLE,       
+    IDLE,
     OPN_SNT,
     CNF_RCVD,
     OPN_RCVD,
@@ -96,7 +98,7 @@
     HOLDING,
   };
   /// Callback type for MLME-SignalPeerLinkStatus event
-  typedef Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerState, PeerLink::PeerState> SignalStatusCallback; 
+  typedef Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerState, PeerLink::PeerState> SignalStatusCallback;
   /// Set callback
   void MLMESetSignalStatusCallback (SignalStatusCallback);
   //\}
@@ -105,17 +107,17 @@
 private:
   /**
    * \name Link response to received management frames
-   * 
+   *
    * \attention In all this methods {local/peer}LinkID correspond to _peer_ station, as written in
    * received frame, e.g. I am peerLinkID and peer link is localLinkID .
-   * 
+   *
    * \{
    */
   /// Close link
   void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
   /// Accept open link
   void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
-  /// Reject open link 
+  /// Reject open link
   void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason);
   /// Confirm accept
   void ConfirmAccept (
@@ -134,10 +136,10 @@
     PmpReasonCode reason
   );
   //\}
-  
+
   /// True if link is established
   bool  LinkIsEstab () const;
-  /// True if link is idle. Link can be deleted in this state 
+  /// True if link is idle. Link can be deleted in this state
   bool  LinkIsIdle () const;
   /**
    * Set pointer to MAC-plugin, which is responsible for sending peer
@@ -162,14 +164,14 @@
     TOC,        ///< Timeout of confirm timer
     TOH,        ///< Timeout of holding (gracefull closing) timer
   };
-  
+
 private:
   /// State transition
   void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED);
-  
-  /** 
+
+  /**
    * \name Event handlers
-   * \{ 
+   * \{
    */
   void ClearRetryTimer ();
   void ClearConfirmTimer ();
@@ -179,7 +181,7 @@
   void SetConfirmTimer ();
   //\}
 
-  /** 
+  /**
    * \name Work with management frames
    * \{
    */
@@ -187,16 +189,16 @@
   void SendPeerLinkOpen ();
   void SendPeerLinkConfirm ();
   //\}
-  
-  /** 
-   * \name Timeout handlers 
+
+  /**
+   * \name Timeout handlers
    * \{
    */
   void HoldingTimeout ();
   void RetryTimeout ();
   void ConfirmTimeout ();
   //\}
-  
+
 private:
   ///The number of interface I am associated with
   uint32_t m_interface;
@@ -215,17 +217,17 @@
   uint16_t m_assocId;
   /// Assoc Id assigned to me by peer
   uint16_t m_peerAssocId;
-    
+
   /// When last beacon was received
   Time  m_lastBeacon;
   /// Current beacon interval on corresponding interface
   Time  m_beaconInterval;
-  
+
   /// Current state
   PeerState m_state;
   /// Mesh interface configuration
   IeConfiguration m_configuration;
-  
+
   // State is a bitfield as defined as follows:
   // This are states for a given
   IeBeaconTiming m_beaconTiming;
@@ -246,14 +248,14 @@
   EventId  m_beaconLossTimer;
   uint16_t  m_maxBeaconLoss;
   //\}
-  
+
   /// Several successive beacons were lost, close link
   void BeaconLoss ();
-   
+
   /// How to report my status change
   SignalStatusCallback m_linkStatusCallback;
 };
-  
+
 } // namespace dot11s
 } //namespace ns3
 #endif /* PEERLLINK_H_ */
--- a/src/devices/mesh/dot11s/peer-management-protocol-mac.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
@@ -27,9 +27,12 @@
 #include "ns3/mesh-wifi-interface-mac.h"
 #include "ns3/simulator.h"
 #include "ns3/wifi-mac-header.h"
-namespace ns3 {
-namespace dot11s {
-PeerManagementProtocolMac::PeerManagementProtocolMac (uint32_t interface, Ptr<PeerManagementProtocol> protocol)
+namespace ns3
+{
+namespace dot11s
+{
+PeerManagementProtocolMac::PeerManagementProtocolMac (uint32_t interface,
+    Ptr<PeerManagementProtocol> protocol)
 {
   m_ifIndex = interface;
   m_protocol = protocol;
@@ -50,143 +53,131 @@
 {
   // First of all we copy a packet, because we need to remove some
   //headers
-  Ptr<Packet> packet = const_packet->Copy();
-  if(header.IsBeacon())
-  {
-    IeBeaconTiming beaconTiming;
-    IeMeshId meshId;
-    Ptr<Packet> myBeacon = packet->Copy();
-    MgtBeaconHeader beacon_hdr;
-    myBeacon->RemoveHeader(beacon_hdr);
-    meshId.FindFirst(myBeacon);
-    bool meshBeacon = false;
-    if (
-        (beaconTiming.FindFirst(myBeacon)) &&
-        (m_protocol->GetMeshId ()->IsEqual(meshId))
-        )
-      {
-        meshBeacon = true;
-      }
-    m_protocol->UpdatePeerBeaconTiming (
-        m_ifIndex,
-        meshBeacon,
-        beaconTiming,
-        header.GetAddr2(),
-        Simulator::Now(),
-        MicroSeconds(beacon_hdr.GetBeaconIntervalUs())
-        );
-    // Beacon shall not be dropeed. May be needed to another plugins
-    return true;
-  }
+  Ptr<Packet> packet = const_packet->Copy ();
+  if (header.IsBeacon ())
+    {
+      IeBeaconTiming beaconTiming;
+      IeMeshId meshId;
+      Ptr<Packet> myBeacon = packet->Copy ();
+      MgtBeaconHeader beacon_hdr;
+      myBeacon->RemoveHeader (beacon_hdr);
+      meshId.FindFirst (myBeacon);
+      bool meshBeacon = false;
+      if ((beaconTiming.FindFirst (myBeacon)) && (m_protocol->GetMeshId ()->IsEqual (meshId)))
+        {
+          meshBeacon = true;
+        }
+      m_protocol->UpdatePeerBeaconTiming (m_ifIndex, meshBeacon, beaconTiming, header.GetAddr2 (),
+          Simulator::Now (), MicroSeconds (beacon_hdr.GetBeaconIntervalUs ()));
+      // Beacon shall not be dropeed. May be needed to another plugins
+      return true;
+    }
   if (header.IsAction ())
-  {
-    WifiMeshActionHeader actionHdr;
-    packet->RemoveHeader (actionHdr);
-    WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
-    // If can not handle - just return;
-    if(actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PEERING_MGT)
-      return m_protocol->IsActiveLink(m_ifIndex,header.GetAddr2());
-    m_stats.rxMgt ++;
-    m_stats.rxMgtBytes += packet->GetSize ();
-    Mac48Address peerAddress = header.GetAddr2 ();
-    Mac48Address peerMpAddress = header.GetAddr3 ();
-    PeerLinkFrameStart::PlinkFrameStartFields fields;
     {
-      PeerLinkFrameStart peerFrame;
-      peerFrame.SetPlinkFrameSubtype ((uint8_t) actionValue.peerLink);
-      packet->RemoveHeader (peerFrame);
-      fields = peerFrame.GetFields ();
-      NS_ASSERT (fields.subtype == actionValue.peerLink);
+      WifiMeshActionHeader actionHdr;
+      packet->RemoveHeader (actionHdr);
+      WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
+      // If can not handle - just return;
+      if (actionHdr.GetCategory () != WifiMeshActionHeader::MESH_PEERING_MGT)
+        {
+          return m_protocol->IsActiveLink (m_ifIndex, header.GetAddr2 ());
+        }
+      m_stats.rxMgt++;
+      m_stats.rxMgtBytes += packet->GetSize ();
+      Mac48Address peerAddress = header.GetAddr2 ();
+      Mac48Address peerMpAddress = header.GetAddr3 ();
+      PeerLinkFrameStart::PlinkFrameStartFields fields;
+        {
+          PeerLinkFrameStart peerFrame;
+          peerFrame.SetPlinkFrameSubtype ((uint8_t) actionValue.peerLink);
+          packet->RemoveHeader (peerFrame);
+          fields = peerFrame.GetFields ();
+          NS_ASSERT (fields.subtype == actionValue.peerLink);
+        }
+      if ((actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CLOSE) && !(m_parent->CheckSupportedRates (
+          fields.rates)))
+        {
+          m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress);
+          // Broken peer link frame - drop it
+          m_stats.brokenMgt++;
+          return false;
+        }
+      if ((actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CONFIRM) && !fields.meshId.IsEqual (
+          *(m_protocol->GetMeshId ())))
+        {
+          m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress);
+          // Broken peer link frame - drop it
+          m_stats.brokenMgt++;
+          return false;
+        }
+      IePeerManagement peerElement;
+      packet->RemoveHeader (peerElement);
+      //Check taht frame subtype corresponds peer link subtype
+      if (peerElement.SubtypeIsOpen ())
+        {
+          m_stats.rxOpen++;
+          NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_OPEN);
+        }
+      if (peerElement.SubtypeIsConfirm ())
+        {
+          m_stats.rxConfirm++;
+          NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CONFIRM);
+        }
+      if (peerElement.SubtypeIsClose ())
+        {
+          m_stats.rxClose++;
+          NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CLOSE);
+        }
+      //Deliver Peer link management frame to protocol:
+      m_protocol->ReceivePeerLinkFrame (m_ifIndex, peerAddress, peerMpAddress, fields.aid, peerElement,
+          fields.config);
+      // if we can handle a frame - drop it
+      return false;
     }
-    if (
-        (actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CLOSE) &&
-        !(m_parent->CheckSupportedRates (fields.rates))
-        )
-      {
-        m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress);
-        // Broken peer link frame - drop it
-        m_stats.brokenMgt ++;
-        return false;
-      }
-    if (
-        (actionValue.peerLink != WifiMeshActionHeader::PEER_LINK_CONFIRM) &&
-        !fields.meshId.IsEqual (*(m_protocol->GetMeshId ()))
-        )
-      {
-        m_protocol->ConfigurationMismatch (m_ifIndex, peerAddress);
-        // Broken peer link frame - drop it
-        m_stats.brokenMgt ++;
-        return false;
-      }
-    IePeerManagement peerElement;
-    packet->RemoveHeader (peerElement);
-    //Check taht frame subtype corresponds peer link subtype
-    if (peerElement.SubtypeIsOpen ())
-    {
-      m_stats.rxOpen ++;
-      NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_OPEN);
-    }
-    if (peerElement.SubtypeIsConfirm ())
-    {
-      m_stats.rxConfirm ++;
-      NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CONFIRM);
-    }
-    if (peerElement.SubtypeIsClose ())
-    {
-      m_stats.rxClose ++;
-      NS_ASSERT (actionValue.peerLink == WifiMeshActionHeader::PEER_LINK_CLOSE);
-    }
-    //Deliver Peer link management frame to protocol:
-    m_protocol->ReceivePeerLinkFrame (m_ifIndex, peerAddress, peerMpAddress, fields.aid, peerElement, fields.config);
-    // if we can handle a frame - drop it
-    return false;
-  }
-  return m_protocol->IsActiveLink (m_ifIndex,header.GetAddr2());
+  return m_protocol->IsActiveLink (m_ifIndex, header.GetAddr2 ());
 }
 bool
-PeerManagementProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to)
+PeerManagementProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header,
+    Mac48Address from, Mac48Address to)
 {
   if (header.IsAction ())
-  {
-    WifiMeshActionHeader actionHdr;
-    packet->PeekHeader (actionHdr);
-    WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
-    if(actionHdr.GetCategory () == WifiMeshActionHeader::MESH_PEERING_MGT)
-      return true;
-  }
+    {
+      WifiMeshActionHeader actionHdr;
+      packet->PeekHeader (actionHdr);
+      WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
+      if (actionHdr.GetCategory () == WifiMeshActionHeader::MESH_PEERING_MGT)
+        {
+          return true;
+        }
+    }
   if (header.GetAddr1 ().IsGroup ())
-  {
-    return true;
-  }
-  else
-  {
-    if (m_protocol->IsActiveLink (m_ifIndex,header.GetAddr1()))
     {
       return true;
     }
-    else
+  else
     {
-      m_stats.dropped ++;
-      return false;
+      if (m_protocol->IsActiveLink (m_ifIndex, header.GetAddr1 ()))
+        {
+          return true;
+        }
+      else
+        {
+          m_stats.dropped++;
+          return false;
+        }
     }
-  }
 }
 void
 PeerManagementProtocolMac::UpdateBeacon (MeshWifiBeacon & beacon) const
 {
-  Ptr<IeBeaconTiming>  beaconTiming = m_protocol->GetBeaconTimingElement (m_ifIndex);
+  Ptr<IeBeaconTiming> beaconTiming = m_protocol->GetBeaconTimingElement (m_ifIndex);
   beacon.AddInformationElement (beaconTiming);
   beacon.AddInformationElement (m_protocol->GetMeshId ());
 }
 
 void
-PeerManagementProtocolMac::SendPeerLinkManagementFrame (
-      Mac48Address peerAddress,
-      Mac48Address peerMpAddress,
-      uint16_t aid,
-      IePeerManagement peerElement,
-      IeConfiguration meshConfig
-      )
+PeerManagementProtocolMac::SendPeerLinkManagementFrame (Mac48Address peerAddress, Mac48Address peerMpAddress,
+    uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
 {
   //Create a packet:
   meshConfig.SetNeighborCount (m_protocol->GetNumberOfLinks ());
@@ -203,7 +194,7 @@
   WifiMeshActionHeader actionHdr;
   if (peerElement.SubtypeIsOpen ())
     {
-      m_stats.txOpen ++;
+      m_stats.txOpen++;
       WifiMeshActionHeader::ActionValue action;
       action.peerLink = WifiMeshActionHeader::PEER_LINK_OPEN;
       fields.subtype = WifiMeshActionHeader::PEER_LINK_OPEN;
@@ -211,7 +202,7 @@
     }
   if (peerElement.SubtypeIsConfirm ())
     {
-      m_stats.txConfirm ++;
+      m_stats.txConfirm++;
       WifiMeshActionHeader::ActionValue action;
       action.peerLink = WifiMeshActionHeader::PEER_LINK_CONFIRM;
       fields.aid = aid;
@@ -220,7 +211,7 @@
     }
   if (peerElement.SubtypeIsClose ())
     {
-      m_stats.txClose ++;
+      m_stats.txClose++;
       WifiMeshActionHeader::ActionValue action;
       action.peerLink = WifiMeshActionHeader::PEER_LINK_CLOSE;
       fields.subtype = WifiMeshActionHeader::PEER_LINK_CLOSE;
@@ -230,7 +221,7 @@
   plinkFrame.SetPlinkFrameStart (fields);
   packet->AddHeader (plinkFrame);
   packet->AddHeader (actionHdr);
-  m_stats.txMgt ++;
+  m_stats.txMgt++;
   m_stats.txMgtBytes += packet->GetSize ();
   // Wifi Mac header:
   WifiMacHeader hdr;
@@ -247,7 +238,7 @@
 Mac48Address
 PeerManagementProtocolMac::GetAddress () const
 {
-  if (m_parent !=  0)
+  if (m_parent != 0)
     {
       return m_parent->GetAddress ();
     }
@@ -256,37 +247,26 @@
       return Mac48Address::Mac48Address ();
     }
 }
-std::pair<Time, Time> 
-PeerManagementProtocolMac::GetBeaconInfo() const
+std::pair<Time, Time>
+PeerManagementProtocolMac::GetBeaconInfo () const
 {
-  std::pair<Time,Time> retval;
+  std::pair<Time, Time> retval;
   retval.first = m_parent->GetTbtt ();
   retval.second = m_parent->GetBeaconInterval ();
   return retval;
 }
 void
-PeerManagementProtocolMac::SetBeaconShift(Time shift)
+PeerManagementProtocolMac::SetBeaconShift (Time shift)
 {
   if (shift != Seconds (0))
     {
-      m_stats.beaconShift ++;
+      m_stats.beaconShift++;
     }
   m_parent->ShiftTbtt (shift);
 }
 PeerManagementProtocolMac::Statistics::Statistics () :
-  txOpen (0),
-  txConfirm (0),
-  txClose (0),
-  rxOpen (0),
-  rxConfirm (0),
-  rxClose (0),
-  dropped (0),
-  brokenMgt (0),
-  txMgt (0),
-  txMgtBytes (0),
-  rxMgt (0),
-  rxMgtBytes (0),
-  beaconShift (0)
+  txOpen (0), txConfirm (0), txClose (0), rxOpen (0), rxConfirm (0), rxClose (0), dropped (0), brokenMgt (0),
+      txMgt (0), txMgtBytes (0), rxMgt (0), rxMgtBytes (0), beaconShift (0)
 {
 }
 void
--- a/src/devices/mesh/dot11s/peer-management-protocol-mac.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.h	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
@@ -23,16 +23,18 @@
 
 #include "ns3/mesh-wifi-interface-mac-plugin.h"
 
-namespace ns3 {
+namespace ns3
+{
 class MeshWifiInterfaceMac;
-namespace dot11s {
+namespace dot11s
+{
 class PeerManagementProtocol;
 class IeConfiguration;
 class IePeerManagement;
 class PeerManagementProtocol;
 /**
  * \ingroup dot11s
- * 
+ *
  * \brief This is plugin to Mesh WiFi MAC, which implements
  * interface to dot11s peer management protocol: it takes proper
  * frames from MAC-layer, extracts peer link management information
@@ -59,7 +61,7 @@
   ///\}
 private:
   friend class PeerManagementProtocol;
-  friend class PeerLink; 
+  friend class PeerLink;
   ///\name BCA functionallity:
   ///\{
   ///\brief Fills TBTT and beacon interval. Needed by BCA
@@ -118,13 +120,13 @@
     uint16_t rxMgt;
     uint32_t rxMgtBytes;
     uint16_t beaconShift;
-    
+
     Statistics ();
     void Print (std::ostream & os) const;
   };
   struct Statistics m_stats;
 };
-  
+
 } // namespace dot11s
 } //namespace ns3
 #endif
--- a/src/devices/mesh/dot11s/peer-management-protocol.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -19,7 +19,6 @@
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  */
 
-
 #include "peer-management-protocol.h"
 
 #include "ie-dot11s-peer-management.h"
@@ -36,11 +35,13 @@
 #include "peer-link.h"
 
 NS_LOG_COMPONENT_DEFINE ("PeerManagementProtocol");
-namespace ns3 {
-namespace dot11s {
+namespace ns3
+{
+namespace dot11s
+{
 /***************************************************
-* PeerManager
-***************************************************/
+ * PeerManager
+ ***************************************************/
 NS_OBJECT_ENSURE_REGISTERED (PeerManagementProtocol);
 
 TypeId
@@ -51,26 +52,27 @@
   .AddConstructor<PeerManagementProtocol> ()
   // maximum number of peer links. Now we calculate the total
   // number of peer links on all interfaces
-  .AddAttribute ("MaxNumberOfPeerLinks",
-      "Maximum number of peer links",
-      UintegerValue (32),
-      MakeUintegerAccessor (&PeerManagementProtocol::m_maxNumberOfPeerLinks),
-      MakeUintegerChecker<uint8_t> ()
-      )
-  .AddAttribute ("MaxBeaconLossForBeaconTiming",
-      "If maximum number of beacons were lost, station will not included in beacon timing element",
-      UintegerValue (3),
-      MakeUintegerAccessor (&PeerManagementProtocol::m_maxBeaconLostForBeaconTiming),
-      MakeUintegerChecker<uint8_t> ()
-      )
-    ;
+  .AddAttribute ( "MaxNumberOfPeerLinks",
+                  "Maximum number of peer links",
+                  UintegerValue (32),
+                  MakeUintegerAccessor (
+                      &PeerManagementProtocol::m_maxNumberOfPeerLinks),
+                  MakeUintegerChecker<uint8_t> ()
+                )
+  .AddAttribute ( "MaxBeaconLossForBeaconTiming",
+                  "If maximum number of beacons were lost, station will not included in beacon timing element",
+                  UintegerValue (3),
+                  MakeUintegerAccessor (
+                      &PeerManagementProtocol::m_maxBeaconLostForBeaconTiming),
+                  MakeUintegerChecker<uint8_t> ()
+                )
+                ;
   return tid;
 }
-PeerManagementProtocol::PeerManagementProtocol ():
-  m_lastAssocId (0),
-  m_lastLocalLinkId (1),
-  m_maxBeaconLostForBeaconTiming (3)
-{}
+PeerManagementProtocol::PeerManagementProtocol () :
+  m_lastAssocId (0), m_lastLocalLinkId (1), m_maxBeaconLostForBeaconTiming (3)
+{
+}
 PeerManagementProtocol::~PeerManagementProtocol ()
 {
 }
@@ -81,7 +83,7 @@
   //deleting each
   for (PeerLinksMap::iterator j = m_peerLinks.begin (); j != m_peerLinks.end (); j++)
     {
-      for (PeerLinksOnInterface::iterator i = j->second.begin (); i != j->second.end(); i++)
+      for (PeerLinksOnInterface::iterator i = j->second.begin (); i != j->second.end (); i++)
         {
           (*i) = 0;
         }
@@ -89,30 +91,30 @@
     }
   m_peerLinks.clear ();
   //cleaning beacon structures:
-  for (BeaconInfoMap::iterator i =  m_neighbourBeacons.begin (); i != m_neighbourBeacons.end (); i ++)
+  for (BeaconInfoMap::iterator i = m_neighbourBeacons.begin (); i != m_neighbourBeacons.end (); i++)
     {
-      i->second.clear();
+      i->second.clear ();
     }
-  m_neighbourBeacons.clear();
+  m_neighbourBeacons.clear ();
 }
 
 bool
 PeerManagementProtocol::Install (Ptr<MeshPointDevice> mp)
 {
   std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces ();
-  for (std::vector<Ptr<NetDevice> >::iterator i = interfaces.begin (); i != interfaces.end (); i ++)
+  for (std::vector<Ptr<NetDevice> >::iterator i = interfaces.begin (); i != interfaces.end (); i++)
     {
       Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice> ();
       if (wifiNetDev == 0)
         {
           return false;
         }
-      Ptr<MeshWifiInterfaceMac>  mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
+      Ptr<MeshWifiInterfaceMac> mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
       if (mac == 0)
         {
           return false;
         }
-      Ptr<PeerManagementProtocolMac> plugin = Create<PeerManagementProtocolMac> ((*i)->GetIfIndex(), this);
+      Ptr<PeerManagementProtocolMac> plugin = Create<PeerManagementProtocolMac> ((*i)->GetIfIndex (), this);
       mac->InstallPlugin (plugin);
       m_plugins[(*i)->GetIfIndex ()] = plugin;
       PeerLinksOnInterface newmap;
@@ -141,7 +143,8 @@
           //check beacon loss and make a timing element
           //if last beacon was m_maxBeaconLostForBeaconTiming beacons ago - we do not put it to the
           //timing element
-          if ((j->second.referenceTbtt + j->second.beaconInterval * Scalar (m_maxBeaconLostForBeaconTiming)) < Simulator::Now ())
+          if ((j->second.referenceTbtt + j->second.beaconInterval * Scalar (m_maxBeaconLostForBeaconTiming))
+              < Simulator::Now ())
             {
               i->second.erase (j);
               break;
@@ -151,13 +154,15 @@
     }
   for (BeaconsOnInterface::const_iterator j = i->second.begin (); j != i->second.end (); j++)
     {
-      retval->AddNeighboursTimingElementUnit (j->second.aid, j->second.referenceTbtt, j->second.beaconInterval);
+      retval->AddNeighboursTimingElementUnit (j->second.aid, j->second.referenceTbtt,
+          j->second.beaconInterval);
     }
   return retval;
 }
 
 void
-PeerManagementProtocol::FillBeaconInfo (uint32_t interface, Mac48Address peerAddress, Time receivingTime, Time beaconInterval)
+PeerManagementProtocol::FillBeaconInfo (uint32_t interface, Mac48Address peerAddress, Time receivingTime,
+    Time beaconInterval)
 {
   BeaconInfoMap::iterator i = m_neighbourBeacons.find (interface);
   if (i == m_neighbourBeacons.end ())
@@ -173,8 +178,10 @@
       newInfo.referenceTbtt = receivingTime;
       newInfo.beaconInterval = beaconInterval;
       newInfo.aid = m_lastAssocId++;
-      if(m_lastAssocId == 0xff)
-        m_lastAssocId = 0;
+      if (m_lastAssocId == 0xff)
+        {
+          m_lastAssocId = 0;
+        }
       i->second[peerAddress] = newInfo;
     }
   else
@@ -185,13 +192,8 @@
 }
 
 void
-PeerManagementProtocol::UpdatePeerBeaconTiming (
-    uint32_t interface,
-    bool meshBeacon,
-    IeBeaconTiming timingElement,
-    Mac48Address peerAddress,
-    Time receivingTime,
-    Time beaconInterval)
+PeerManagementProtocol::UpdatePeerBeaconTiming (uint32_t interface, bool meshBeacon,
+    IeBeaconTiming timingElement, Mac48Address peerAddress, Time receivingTime, Time beaconInterval)
 {
   FillBeaconInfo (interface, peerAddress, receivingTime, beaconInterval);
   if (!meshBeacon)
@@ -204,11 +206,11 @@
   Time shift = GetNextBeaconShift (interface);
   if (TimeToTu (shift) != 0)
     {
-      plugin->second->SetBeaconShift(shift);
+      plugin->second->SetBeaconShift (shift);
     }
   //PM STATE Machine
   //Check that a given beacon is not from our interface
-  for (PeerManagementProtocolMacMap::const_iterator i = m_plugins.begin (); i != m_plugins.end (); i ++)
+  for (PeerManagementProtocolMacMap::const_iterator i = m_plugins.begin (); i != m_plugins.end (); i++)
     {
       if (i->second->GetAddress () == peerAddress)
         {
@@ -216,7 +218,7 @@
         }
     }
   Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
-  if (peerLink !=0)  
+  if (peerLink != 0)
     {
       peerLink->SetBeaconTimingElement (timingElement);
       peerLink->SetBeaconInformation (receivingTime, beaconInterval);
@@ -224,40 +226,38 @@
   else
     {
       if (ShouldSendOpen (interface, peerAddress))
-      {
-        peerLink = InitiateLink (interface, peerAddress, Mac48Address::GetBroadcast (), receivingTime, beaconInterval);
-        peerLink->SetBeaconTimingElement (timingElement);
-        peerLink->MLMEActivePeerLinkOpen ();
-      }
+        {
+          peerLink = InitiateLink (interface, peerAddress, Mac48Address::GetBroadcast (), receivingTime,
+              beaconInterval);
+          peerLink->SetBeaconTimingElement (timingElement);
+          peerLink->MLMEActivePeerLinkOpen ();
+        }
     }
 }
 
 void
-PeerManagementProtocol::ReceivePeerLinkFrame (
-    uint32_t interface,
-    Mac48Address peerAddress,
-    Mac48Address peerMeshPointAddress,
-    uint16_t aid,
-    IePeerManagement peerManagementElement,
-    IeConfiguration meshConfig
-)
+PeerManagementProtocol::ReceivePeerLinkFrame (uint32_t interface, Mac48Address peerAddress,
+    Mac48Address peerMeshPointAddress, uint16_t aid, IePeerManagement peerManagementElement,
+    IeConfiguration meshConfig)
 {
-  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
+  Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
   if (peerManagementElement.SubtypeIsOpen ())
     {
       PmpReasonCode reasonCode;
-      bool reject = ! (ShouldAcceptOpen (interface, peerAddress,reasonCode));
+      bool reject = !(ShouldAcceptOpen (interface, peerAddress, reasonCode));
       if (peerLink == 0)
         {
-          peerLink = InitiateLink (interface, peerAddress, peerMeshPointAddress, Simulator::Now (), Seconds(1.0));
+          peerLink = InitiateLink (interface, peerAddress, peerMeshPointAddress, Simulator::Now (), Seconds (
+              1.0));
         }
       if (!reject)
         {
-          peerLink->OpenAccept (peerManagementElement.GetLocalLinkId(), meshConfig, peerMeshPointAddress);
+          peerLink->OpenAccept (peerManagementElement.GetLocalLinkId (), meshConfig, peerMeshPointAddress);
         }
       else
         {
-          peerLink->OpenReject (peerManagementElement.GetLocalLinkId(), meshConfig, peerMeshPointAddress, reasonCode);
+          peerLink->OpenReject (peerManagementElement.GetLocalLinkId (), meshConfig, peerMeshPointAddress,
+              reasonCode);
         }
     }
   if (peerLink == 0)
@@ -266,20 +266,13 @@
     }
   if (peerManagementElement.SubtypeIsConfirm ())
     {
-      peerLink->ConfirmAccept (
-          peerManagementElement.GetLocalLinkId(),
-          peerManagementElement.GetPeerLinkId(),
-          aid,
-          meshConfig,
-          peerMeshPointAddress);
+      peerLink->ConfirmAccept (peerManagementElement.GetLocalLinkId (),
+          peerManagementElement.GetPeerLinkId (), aid, meshConfig, peerMeshPointAddress);
     }
   if (peerManagementElement.SubtypeIsClose ())
     {
-      peerLink->Close (
-          peerManagementElement.GetLocalLinkId(),
-          peerManagementElement.GetPeerLinkId(),
-          peerManagementElement.GetReasonCode()
-          );
+      peerLink->Close (peerManagementElement.GetLocalLinkId (), peerManagementElement.GetPeerLinkId (),
+          peerManagementElement.GetReasonCode ());
     }
 }
 void
@@ -293,12 +286,8 @@
 }
 
 Ptr<PeerLink>
-PeerManagementProtocol::InitiateLink (
-    uint32_t interface,
-    Mac48Address peerAddress,
-    Mac48Address peerMeshPointAddress,
-    Time lastBeacon,
-    Time beaconInterval)
+PeerManagementProtocol::InitiateLink (uint32_t interface, Mac48Address peerAddress,
+    Mac48Address peerMeshPointAddress, Time lastBeacon, Time beaconInterval)
 {
   Ptr<PeerLink> new_link = CreateObject<PeerLink> ();
   if (m_lastLocalLinkId == 0xff)
@@ -307,27 +296,27 @@
     }
   //find a beacon entry
   BeaconInfoMap::iterator beaconsOnInterface = m_neighbourBeacons.find (interface);
-  if (beaconsOnInterface == m_neighbourBeacons.end())
+  if (beaconsOnInterface == m_neighbourBeacons.end ())
     {
-      FillBeaconInfo(interface, peerAddress, lastBeacon, beaconInterval);
+      FillBeaconInfo (interface, peerAddress, lastBeacon, beaconInterval);
     }
   beaconsOnInterface = m_neighbourBeacons.find (interface);
   BeaconsOnInterface::iterator beacon = beaconsOnInterface->second.find (peerAddress);
   if (beacon == beaconsOnInterface->second.end ())
     {
-      FillBeaconInfo(interface, peerAddress, lastBeacon, beaconInterval);
+      FillBeaconInfo (interface, peerAddress, lastBeacon, beaconInterval);
     }
   beacon = beaconsOnInterface->second.find (peerAddress);
   //find a peer link  - it must not exist
-  if (FindPeerLink(interface, peerAddress) != 0)
+  if (FindPeerLink (interface, peerAddress) != 0)
     {
       NS_FATAL_ERROR ("Peer link must not exist.");
     }
   // Plugin must exist
   PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
-  NS_ASSERT(plugin != m_plugins.end ());
+  NS_ASSERT (plugin != m_plugins.end ());
   PeerLinksMap::iterator iface = m_peerLinks.find (interface);
-  NS_ASSERT (iface != m_peerLinks.end());
+  NS_ASSERT (iface != m_peerLinks.end ());
   new_link->SetLocalAid (beacon->second.aid);
   new_link->SetInterface (interface);
   new_link->SetLocalLinkId (m_lastLocalLinkId++);
@@ -335,35 +324,36 @@
   new_link->SetPeerMeshPointAddress (peerMeshPointAddress);
   new_link->SetBeaconInformation (lastBeacon, beaconInterval);
   new_link->SetMacPlugin (plugin->second);
-  new_link->MLMESetSignalStatusCallback (MakeCallback(&PeerManagementProtocol::PeerLinkStatus, this));
-  iface->second.push_back (new_link);  
+  new_link->MLMESetSignalStatusCallback (MakeCallback (&PeerManagementProtocol::PeerLinkStatus, this));
+  iface->second.push_back (new_link);
   return new_link;
 }
 Ptr<PeerLink>
-PeerManagementProtocol::FindPeerLink(uint32_t interface, Mac48Address peerAddress)
+PeerManagementProtocol::FindPeerLink (uint32_t interface, Mac48Address peerAddress)
 {
   PeerLinksMap::iterator iface = m_peerLinks.find (interface);
-  NS_ASSERT (iface != m_peerLinks.end());
-  for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end(); i++)
-  {
-    if ((*i)->GetPeerAddress () == peerAddress)
-      {
-        if((*i)->LinkIsIdle ())
-          {
-            (*i) = 0;
-            (iface->second).erase(i);
-            return 0;
-          }
-        else
+  NS_ASSERT (iface != m_peerLinks.end ());
+  for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
+    {
+      if ((*i)->GetPeerAddress () == peerAddress)
         {
-          return (*i);
+          if ((*i)->LinkIsIdle ())
+            {
+              (*i) = 0;
+              (iface->second).erase (i);
+              return 0;
+            }
+          else
+            {
+              return (*i);
+            }
         }
-      }
-  }
+    }
   return 0;
 }
 void
-PeerManagementProtocol::SetPeerLinkStatusCallback(Callback <void, Mac48Address, Mac48Address, uint32_t, bool> cb)
+PeerManagementProtocol::SetPeerLinkStatusCallback (
+    Callback<void, Mac48Address, Mac48Address, uint32_t, bool> cb)
 {
   m_peerStatusCallback = cb;
 }
@@ -372,20 +362,20 @@
 {
   std::vector<Mac48Address> retval;
   PeerLinksMap::iterator iface = m_peerLinks.find (interface);
-  NS_ASSERT (iface != m_peerLinks.end());
-  for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end(); i++)
-  {
-    if ((*i)->LinkIsEstab ())
+  NS_ASSERT (iface != m_peerLinks.end ());
+  for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
     {
-      retval.push_back((*i)->GetPeerAddress ());
+      if ((*i)->LinkIsEstab ())
+        {
+          retval.push_back ((*i)->GetPeerAddress ());
+        }
     }
-  }
   return retval;
 }
 bool
 PeerManagementProtocol::IsActiveLink (uint32_t interface, Mac48Address peerAddress)
 {
-  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
+  Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
   if (peerLink != 0)
     {
       return (peerLink->LinkIsEstab ());
@@ -398,9 +388,7 @@
   return (m_stats.linksTotal <= m_maxNumberOfPeerLinks);
 }
 bool
-PeerManagementProtocol::ShouldAcceptOpen (
-    uint32_t interface,
-    Mac48Address peerAddress,
+PeerManagementProtocol::ShouldAcceptOpen (uint32_t interface, Mac48Address peerAddress,
     PmpReasonCode & reasonCode)
 {
   if (m_stats.linksTotal > m_maxNumberOfPeerLinks)
@@ -420,9 +408,9 @@
   static int maxShift = 15;
   static int minShift = 1;
   PeerLinksMap::iterator iface = m_peerLinks.find (interface);
-  NS_ASSERT (iface != m_peerLinks.end());
+  NS_ASSERT (iface != m_peerLinks.end ());
   PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
-  NS_ASSERT (plugin != m_plugins.end());
+  NS_ASSERT (plugin != m_plugins.end ());
   std::pair<Time, Time> myBeacon = plugin->second->GetBeaconInfo ();
   if (Simulator::Now () + TuToTime (maxShift) > myBeacon.first + myBeacon.second)
     {
@@ -435,25 +423,31 @@
         {
           continue;
         }
-      neighbours = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList();
+      neighbours = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList ();
       //Going through all my timing elements and detecting future beacon collisions
-      for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j != neighbours.end (); j++)
+      for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j
+          != neighbours.end (); j++)
+        {
           //We apply MBAC only if beacon Intervals are equal
           if ((*j)->GetBeaconInterval () == TimeToTu (myBeacon.second))
             {
               //Apply MBCA if future beacons may coinside
-              if ((TimeToTu (myBeacon.first) - ((*j)->GetLastBeacon ()/4)) % ((*j)->GetBeaconInterval ()) == 0)
-              {
-                UniformVariable randomSign (-1, 1);
-                UniformVariable randomShift (minShift, maxShift);
-                int beaconShift = randomShift.GetInteger (minShift,maxShift) * ((randomSign.GetValue () >= 0) ? 1 : -1);
-                NS_LOG_DEBUG ("Apply MBCA: Shift value = " << beaconShift << " beacon TUs");
-                //Do not shift to the past!
-                return (TuToTime (beaconShift) + Simulator::Now () < myBeacon.first) ? TuToTime (beaconShift) : TuToTime (0);
-              }
+              if ((TimeToTu (myBeacon.first) - ((*j)->GetLastBeacon () / 4)) % ((*j)->GetBeaconInterval ())
+                  == 0)
+                {
+                  UniformVariable randomSign (-1, 1);
+                  UniformVariable randomShift (minShift, maxShift);
+                  int beaconShift = randomShift.GetInteger (minShift, maxShift) * ((randomSign.GetValue ()
+                      >= 0) ? 1 : -1);
+                  NS_LOG_DEBUG ("Apply MBCA: Shift value = " << beaconShift << " beacon TUs");
+                  //Do not shift to the past!
+                  return (TuToTime (beaconShift) + Simulator::Now () < myBeacon.first) ? TuToTime (
+                      beaconShift) : TuToTime (0);
+                }
             }
+        }
     }
-    return MicroSeconds (0);
+  return MicroSeconds (0);
 }
 Time
 PeerManagementProtocol::TuToTime (uint32_t x)
@@ -466,20 +460,17 @@
   return (uint32_t) (x.GetMicroSeconds () / 1024);
 }
 void
-PeerManagementProtocol::PeerLinkStatus (uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddress, PeerLink::PeerState ostate, PeerLink::PeerState nstate)
+PeerManagementProtocol::PeerLinkStatus (uint32_t interface, Mac48Address peerAddress,
+    Mac48Address peerMeshPointAddress, PeerLink::PeerState ostate, PeerLink::PeerState nstate)
 {
   PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
-  NS_ASSERT (plugin != m_plugins.end());
-  NS_LOG_DEBUG (
-      "Link between me:" << m_address <<
-      " my interface:" << plugin->second->GetAddress() <<
-      " and peer mesh point:" << peerMeshPointAddress <<
-      " and its interface:" << peerAddress <<
-      ", at my interface ID:" << interface <<
-      ". State movement:" << ostate << " -> " << nstate);
+  NS_ASSERT (plugin != m_plugins.end ());
+  NS_LOG_DEBUG ("Link between me:" << m_address << " my interface:" << plugin->second->GetAddress ()
+      << " and peer mesh point:" << peerMeshPointAddress << " and its interface:" << peerAddress
+      << ", at my interface ID:" << interface << ". State movement:" << ostate << " -> " << nstate);
   if ((nstate == PeerLink::ESTAB) && (ostate != PeerLink::ESTAB))
     {
-      m_stats.linksOpened ++;
+      m_stats.linksOpened++;
       m_stats.linksTotal++;
       if (!m_peerStatusCallback.IsNull ())
         {
@@ -488,7 +479,7 @@
     }
   if ((ostate == PeerLink::ESTAB) && (nstate != PeerLink::ESTAB))
     {
-      m_stats.linksClosed ++;
+      m_stats.linksClosed++;
       m_stats.linksTotal--;
       if (!m_peerStatusCallback.IsNull ())
         {
@@ -497,7 +488,7 @@
     }
   if (nstate == PeerLink::IDLE)
     {
-      Ptr <PeerLink> link = FindPeerLink (interface, peerAddress);
+      Ptr<PeerLink> link = FindPeerLink (interface, peerAddress);
       NS_ASSERT (link == 0);
     }
 }
@@ -513,7 +504,7 @@
   return m_meshId;
 }
 void
-PeerManagementProtocol::SetMeshId(std::string s)
+PeerManagementProtocol::SetMeshId (std::string s)
 {
   m_meshId = Create<IeMeshId> (s);
 }
@@ -523,31 +514,30 @@
   return m_address;
 }
 PeerManagementProtocol::Statistics::Statistics (uint16_t t) :
-  linksTotal(t),
-  linksOpened (0),
-  linksClosed (0)
-{}
+  linksTotal (t), linksOpened (0), linksClosed (0)
+{
+}
 void
 PeerManagementProtocol::Statistics::Print (std::ostream & os) const
 {
   os << "<Statistics "
-  "linksTotal=\""  << linksTotal <<  "\" " 
-  "linksOpened=\"" << linksOpened << "\" "
-  "linksClosed=\"" << linksClosed << "\"/>\n";
+    "linksTotal=\"" << linksTotal << "\" "
+    "linksOpened=\"" << linksOpened << "\" "
+    "linksClosed=\"" << linksClosed << "\"/>\n";
 }
 void
 PeerManagementProtocol::Report (std::ostream & os) const
 {
   os << "<PeerManagementProtocol>\n";
   m_stats.Print (os);
-  for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins ++)
+  for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins++)
     {
       //Take statistics from plugin:
       plugins->second->Report (os);
       //Print all active peer links:
       PeerLinksMap::const_iterator iface = m_peerLinks.find (plugins->second->m_ifIndex);
-      NS_ASSERT (iface != m_peerLinks.end());
-      for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); i != iface->second.end(); i++)
+      NS_ASSERT (iface != m_peerLinks.end ());
+      for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); i != iface->second.end (); i++)
         {
           (*i)->Report (os);
         }
@@ -558,7 +548,7 @@
 PeerManagementProtocol::ResetStats ()
 {
   m_stats = Statistics::Statistics (m_stats.linksTotal); // don't reset number of links
-  for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins ++)
+  for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins++)
     {
       plugins->second->ResetStats ();
     }
--- a/src/devices/mesh/dot11s/peer-management-protocol.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol.h	Wed Jul 22 14:52:42 2009 +0400
@@ -19,7 +19,6 @@
  *          Aleksey Kovalenko <kovalenko@iitp.ru>
  */
 
-
 #ifndef DOT11S_PEER_MAN_H
 #define DOT11S_PEER_MAN_H
 
@@ -33,17 +32,19 @@
 #include "peer-link.h"
 
 #include <map>
-namespace ns3 {
+namespace ns3
+{
 class MeshPointDevice;
-namespace dot11s {
+namespace dot11s
+{
 class PeerManagementProtocolMac;
 class PeerLink;
 class IePeerManagement;
 class IeConfiguration;
 /**
  * \ingroup dot11s
- * 
- * \brief 802.11s Peer Management Protocol model 
+ *
+ * \brief 802.11s Peer Management Protocol model
  */
 class PeerManagementProtocol : public Object
 {
@@ -52,18 +53,18 @@
   ~PeerManagementProtocol ();
   static TypeId GetTypeId ();
   void DoDispose ();
-  /** 
-   * \brief Install PMP on given mesh point. 
-   * 
+  /**
+   * \brief Install PMP on given mesh point.
+   *
    * Installing protocol cause installing its interface MAC plugins.
-   *  
-   * Also MP aggregates all installed protocols, PMP protocol can be accessed 
+   *
+   * Also MP aggregates all installed protocols, PMP protocol can be accessed
    * via MeshPointDevice::GetObject<PeerManagementProtocol>();
    */
   bool Install(Ptr<MeshPointDevice>);
-  /** 
+  /**
    * \brief Methods that handle beacon sending/receiving procedure.
-   * 
+   *
    * This methods interact with MAC_layer plug-in
    * \{
    */
@@ -242,7 +243,7 @@
   struct Statistics m_stats;
 
 };
-  
+
 } // namespace dot11s
 } //namespace ns3
 #endif
--- a/src/devices/mesh/flame/flame-header.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-header.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -24,23 +24,23 @@
 
 #include "flame-header.h"
 
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 FlameHeader::FlameHeader () :
-  m_cost (0),
-  m_seqno (0),
-  m_origDst (Mac48Address ()),
-  m_origSrc (Mac48Address ())
-{}
+  m_cost (0), m_seqno (0), m_origDst (Mac48Address ()), m_origSrc (Mac48Address ())
+{
+}
 FlameHeader::~FlameHeader ()
-{}
+{
+}
 TypeId
 FlameHeader::GetTypeId (void)
 {
   static TypeId tid = TypeId ("ns3::FlameHeader")
     .SetParent<Header> ()
-    .AddConstructor<FlameHeader> ()
-    ;
+    .AddConstructor<FlameHeader> ();
   return tid;
 }
 TypeId
@@ -51,27 +51,25 @@
 void
 FlameHeader::Print (std::ostream &os) const
 {
-  os << "Cost             = " << (uint16_t)m_cost <<
-      "\nSequence number  = " << m_seqno <<
-      "\nOrig Destination = " << m_origDst <<
-      "\nOrig Source      = " << m_origSrc << "\n";
+  os << "Cost             = " << (uint16_t) m_cost << "\nSequence number  = " << m_seqno
+      << "\nOrig Destination = " << m_origDst << "\nOrig Source      = " << m_origSrc << "\n";
 }
 uint32_t
 FlameHeader::GetSerializedSize (void) const
 {
-  return 1  // Reserved
-    + 1     // Cost
-    + 2     // Seqno
-    + 6     // Orig Dst
-    + 6     // Orig Src
-    + 2     // Flame Port
-    ;
+  return 1 // Reserved
+      + 1 // Cost
+      + 2 // Seqno
+      + 6 // Orig Dst
+      + 6 // Orig Src
+      + 2 // Flame Port
+  ;
 }
 void
 FlameHeader::Serialize (Buffer::Iterator start) const
 {
   Buffer::Iterator i = start;
-  i.WriteU8 (0);  //Reserved
+  i.WriteU8 (0); //Reserved
   i.WriteU8 (m_cost); //Cost
   i.WriteHtonU16 (m_seqno); //Seqno
   WriteTo (i, m_origDst);
@@ -93,7 +91,7 @@
 void
 FlameHeader::AddCost (uint8_t cost)
 {
-  m_cost = (((uint16_t)cost+ (uint16_t)m_cost ) > 255) ? 255 : cost + m_cost;
+  m_cost = (((uint16_t) cost + (uint16_t) m_cost) > 255) ? 255 : cost + m_cost;
 }
 uint8_t
 FlameHeader::GetCost () const
@@ -140,43 +138,44 @@
 {
   return m_protocol;
 }
-bool operator== (const FlameHeader & a, const FlameHeader & b)
+bool
+operator== (const FlameHeader & a, const FlameHeader & b)
 {
-  return (
-      (a.m_cost == b.m_cost) &&
-      (a.m_seqno == b.m_seqno) &&
-      (a.m_origDst == b.m_origDst) &&
-      (a.m_origSrc == b.m_origSrc) &&
-      (a.m_protocol == b.m_protocol)
-      );
+  return ((a.m_cost == b.m_cost) && (a.m_seqno == b.m_seqno) && (a.m_origDst == b.m_origDst) && (a.m_origSrc
+      == b.m_origSrc) && (a.m_protocol == b.m_protocol));
 }
 
 #ifdef RUN_SELF_TESTS
 
 /// Built-in self test for FlameHeader
-struct FlameHeaderBist : public Test 
+struct FlameHeaderBist : public Test
 {
-  FlameHeaderBist () : Test ("mesh/flame/FlameHeader") {}
-  virtual bool RunTests(); 
+  FlameHeaderBist () :
+    Test ("mesh/flame/FlameHeader")
+  {
+  }
+  virtual bool
+  RunTests ();
 };
 
 /// Test instance
 static FlameHeaderBist g_FlameHeaderBist;
 
-bool FlameHeaderBist::RunTests ()
+bool
+FlameHeaderBist::RunTests ()
 {
   bool result (true);
-    FlameHeader a;
-    a.AddCost (123);
-    a.SetSeqno (456);
-    a.SetOrigDst (Mac48Address ("11:22:33:44:55:66"));
-    a.SetOrigSrc (Mac48Address ("00:11:22:33:44:55"));
-    a.SetProtocol (0x806);
-    Ptr<Packet> packet = Create<Packet> ();
-    packet->AddHeader (a);
-    FlameHeader b;
-    packet->RemoveHeader (b);
-    NS_TEST_ASSERT_EQUAL (b, a);
+  FlameHeader a;
+  a.AddCost (123);
+  a.SetSeqno (456);
+  a.SetOrigDst (Mac48Address ("11:22:33:44:55:66"));
+  a.SetOrigSrc (Mac48Address ("00:11:22:33:44:55"));
+  a.SetProtocol (0x806);
+  Ptr<Packet> packet = Create<Packet> ();
+  packet->AddHeader (a);
+  FlameHeader b;
+  packet->RemoveHeader (b);
+  NS_TEST_ASSERT_EQUAL (b, a);
   return result;
 }
 #endif
--- a/src/devices/mesh/flame/flame-header.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-header.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,24 +18,25 @@
  * Author: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef FLAME_HEADER_H
 #define FLAME_HEADER_H
 
 #include "ns3/header.h"
 #include "ns3/mac48-address.h"
 
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 /**
  * \ingroup flame
- * 
+ *
  * \brief Flame header
- * 
+ *
  * Header format: | Reserved: 1 | cost: 1 | Sequence number: 2 | OrigDst: 6 | OrigSrc: 6 | Flame port : 2 |
  */
 
-class FlameHeader : public Header 
+class FlameHeader : public Header
 {
 public:
 
--- a/src/devices/mesh/flame/flame-installer.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-installer.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -21,7 +21,8 @@
 #include "flame-installer.h"
 #include "flame-protocol.h"
 
-namespace ns3 {
+namespace ns3
+{
 using namespace flame;
 NS_OBJECT_ENSURE_REGISTERED (FlameStack);
 TypeId
@@ -29,14 +30,15 @@
 {
   static TypeId tid = TypeId ("ns3::FlameStack")
     .SetParent<Object> ()
-    .AddConstructor<FlameStack> ()
-    ;
+    .AddConstructor<FlameStack> ();
   return tid;
 }
 FlameStack::FlameStack ()
-{}
+{
+}
 FlameStack::~FlameStack ()
-{}
+{
+}
 void
 FlameStack::DoDispose ()
 {
@@ -52,8 +54,8 @@
 {
   mp->Report (os);
   // TODO report flame counters
-  Ptr <FlameProtocol> flame = mp->GetObject<FlameProtocol> ();
-  NS_ASSERT(flame != 0);
+  Ptr<FlameProtocol> flame = mp->GetObject<FlameProtocol> ();
+  NS_ASSERT (flame != 0);
   flame->Report (os);
 }
 void
@@ -61,8 +63,8 @@
 {
   mp->ResetStats ();
   // TODO reset flame counters
-  Ptr <FlameProtocol> flame = mp->GetObject<FlameProtocol> ();
-  NS_ASSERT(flame != 0);
+  Ptr<FlameProtocol> flame = mp->GetObject<FlameProtocol> ();
+  NS_ASSERT (flame != 0);
 
   flame->ResetStats ();
 }
--- a/src/devices/mesh/flame/flame-installer.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-installer.h	Wed Jul 22 14:52:42 2009 +0400
@@ -18,14 +18,14 @@
  * Authors: Kirill Andreev <andreev@iitp.ru>
  */
 
-
 #ifndef FLAME_STACK_INSTALLER_H
 #define FLAME_STACK_INSTALLER_H
 #include "ns3/mesh-stack-installer.h"
-namespace ns3 {
+namespace ns3
+{
 /**
  * \ingroup flame
- * 
+ *
  * \brief FLAME mesh stack (actually single protocol in this stack)
  */
 class FlameStack : public MeshStack
--- a/src/devices/mesh/flame/flame-protocol-mac.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-protocol-mac.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -22,12 +22,13 @@
 #include "flame-protocol.h"
 #include "flame-header.h"
 #include "ns3/log.h"
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 NS_LOG_COMPONENT_DEFINE ("FlameProtocolMac");
-FlameProtocolMac::FlameProtocolMac (uint32_t ifIndex, Ptr<FlameProtocol> protocol):
-  m_protocol (protocol),
-  m_ifIndex (ifIndex)
+FlameProtocolMac::FlameProtocolMac (uint32_t ifIndex, Ptr<FlameProtocol> protocol) :
+  m_protocol (protocol), m_ifIndex (ifIndex)
 {
 }
 FlameProtocolMac::~FlameProtocolMac ()
@@ -43,37 +44,50 @@
 FlameProtocolMac::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
 {
   if (!header.IsData ())
-    return true;
+    {
+      return true;
+    }
   FlameTag tag;
-  if(packet->PeekPacketTag (tag))
-  {
-    NS_FATAL_ERROR ("FLAME tag is not supposed to be received by network");
-  }
+  if (packet->PeekPacketTag (tag))
+    {
+      NS_FATAL_ERROR ("FLAME tag is not supposed to be received by network");
+    }
   tag.receiver = header.GetAddr1 ();
   tag.transmitter = header.GetAddr2 ();
-  if(tag.receiver == Mac48Address::GetBroadcast ())
-    m_stats.rxBroadcast ++;
+  if (tag.receiver == Mac48Address::GetBroadcast ())
+    {
+      m_stats.rxBroadcast++;
+    }
   else
-    m_stats.rxUnicast ++;
+    {
+      m_stats.rxUnicast++;
+    }
   m_stats.rxBytes += packet->GetSize ();
   packet->AddPacketTag (tag);
   return true;
 }
 bool
-FlameProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to)
+FlameProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from,
+    Mac48Address to)
 {
-  if(!header.IsData ())
-    return true;
+  if (!header.IsData ())
+    {
+      return true;
+    }
   FlameTag tag;
-  if(!packet->RemovePacketTag (tag))
-  {
-    NS_FATAL_ERROR ("FLAME tag must exist here");
-  }
+  if (!packet->RemovePacketTag (tag))
+    {
+      NS_FATAL_ERROR ("FLAME tag must exist here");
+    }
   header.SetAddr1 (tag.receiver);
-  if(tag.receiver == Mac48Address::GetBroadcast ())
-    m_stats.txBroadcast ++;
+  if (tag.receiver == Mac48Address::GetBroadcast ())
+    {
+      m_stats.txBroadcast++;
+    }
   else
-    m_stats.txUnicast ++;
+    {
+      m_stats.txUnicast++;
+    }
   m_stats.txBytes += packet->GetSize ();
   return true;
 }
@@ -83,13 +97,9 @@
   return m_parent->GetFrequencyChannel ();
 }
 FlameProtocolMac::Statistics::Statistics () :
-  txUnicast (0),
-  txBroadcast (0),
-  txBytes (0),
-  rxUnicast (0),
-  rxBroadcast (0),
-  rxBytes (0)
-{}
+  txUnicast (0), txBroadcast (0), txBytes (0), rxUnicast (0), rxBroadcast (0), rxBytes (0)
+{
+}
 void
 FlameProtocolMac::Statistics::Print (std::ostream &os) const
 {
@@ -105,8 +115,8 @@
 FlameProtocolMac::Report (std::ostream & os) const
 {
   os << "<FlameProtocolMac\n"
-    "address =\""<< m_parent->GetAddress () <<"\">\n";
-  m_stats.Print(os);
+    "address =\"" << m_parent->GetAddress () << "\">\n";
+  m_stats.Print (os);
   os << "</FlameProtocolMac>\n";
 
 }
--- a/src/devices/mesh/flame/flame-protocol-mac.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-protocol-mac.h	Wed Jul 22 14:52:42 2009 +0400
@@ -23,12 +23,14 @@
 
 #include "ns3/mesh-wifi-interface-mac.h"
 
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 class FlameProtocol;
 /**
  * \ingroup flame
- * 
+ *
  * \brief Interface MAC plugin FLAME routing protocol
  */
 class FlameProtocolMac : public MeshWifiInterfaceMacPlugin
--- a/src/devices/mesh/flame/flame-protocol.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-protocol.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -32,8 +32,10 @@
 
 NS_LOG_COMPONENT_DEFINE ("FlameProtocol");
 
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 //-----------------------------------------------------------------------------
 // FlameTag
 //-----------------------------------------------------------------------------
@@ -42,10 +44,8 @@
 TypeId
 FlameTag::GetTypeId ()
 {
-  static TypeId tid = TypeId ("ns3::flame::FlameTag")
-    .SetParent<Tag> ()
-    .AddConstructor<FlameTag> ();
-   return tid;
+  static TypeId tid = TypeId ("ns3::flame::FlameTag") .SetParent<Tag> () .AddConstructor<FlameTag> ();
+  return tid;
 }
 
 TypeId
@@ -65,11 +65,15 @@
 {
   uint8_t buf[6];
   receiver.CopyTo (buf);
-  for (int j = 0; j < 6; j ++)
-    i.WriteU8 (buf[j]);
+  for (int j = 0; j < 6; j++)
+    {
+      i.WriteU8 (buf[j]);
+    }
   transmitter.CopyTo (buf);
-  for (int j = 0; j < 6; j ++)
-    i.WriteU8 (buf[j]);
+  for (int j = 0; j < 6; j++)
+    {
+      i.WriteU8 (buf[j]);
+    }
 
 }
 
@@ -77,11 +81,15 @@
 FlameTag::Deserialize (TagBuffer i)
 {
   uint8_t buf[6];
-  for (int j = 0; j < 6; j ++)
-    buf[j] = i.ReadU8 ();
+  for (int j = 0; j < 6; j++)
+    {
+      buf[j] = i.ReadU8 ();
+    }
   receiver.CopyFrom (buf);
-  for (int j = 0; j < 6; j ++)
-    buf[j] = i.ReadU8 ();
+  for (int j = 0; j < 6; j++)
+    {
+      buf[j] = i.ReadU8 ();
+    }
   transmitter.CopyFrom (buf);
 
 }
@@ -101,25 +109,26 @@
   static TypeId tid = TypeId ("ns3::flame::FlameProtocol")
     .SetParent<MeshL2RoutingProtocol> ()
     .AddConstructor<FlameProtocol> ()
-    .AddAttribute ("BroadcastInterval", "How often we must send broadcast packets",
-        TimeValue (Seconds (5)),
-        MakeTimeAccessor (&FlameProtocol::m_broadcastInterval),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("MaxCost", "Cost threshold after which packet will be dropeed",
-        UintegerValue (32),
-        MakeUintegerAccessor (&FlameProtocol::m_maxCost),
-        MakeUintegerChecker<uint8_t> (3)
-        );
+    .AddAttribute ( "BroadcastInterval",
+                    "How often we must send broadcast packets",
+                    TimeValue (Seconds (5)),
+                    MakeTimeAccessor (
+                        &FlameProtocol::m_broadcastInterval),
+                    MakeTimeChecker ()
+                    )
+    .AddAttribute ( "MaxCost",
+                    "Cost threshold after which packet will be dropeed",
+                    UintegerValue (32),
+                    MakeUintegerAccessor (
+                        &FlameProtocol::m_maxCost),
+                    MakeUintegerChecker<uint8_t> (3)
+                    )
+                    ;
   return tid;
 }
 FlameProtocol::FlameProtocol () :
-  m_address (Mac48Address ()),
-  m_broadcastInterval (Seconds (5)),
-  m_lastBroadcast (Simulator::Now ()),
-  m_maxCost (32),
-  m_myLastSeqno (0),
-  m_rtable (CreateObject<FlameRtable> ())
+  m_address (Mac48Address ()), m_broadcastInterval (Seconds (5)), m_lastBroadcast (Simulator::Now ()),
+      m_maxCost (32), m_myLastSeqno (0), m_rtable (CreateObject<FlameRtable> ())
 {
 }
 FlameProtocol::~FlameProtocol ()
@@ -130,144 +139,159 @@
 {
 }
 bool
-FlameProtocol::RequestRoute (uint32_t  sourceIface, const Mac48Address source, const Mac48Address destination,
-      Ptr<const Packet> const_packet, uint16_t  protocolType, RouteReplyCallback  routeReply)
+FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
+    Ptr<const Packet> const_packet, uint16_t protocolType, RouteReplyCallback routeReply)
 {
   Ptr<Packet> packet = const_packet->Copy ();
   if (sourceIface == m_mp->GetIfIndex ())
-  {
-    //Packet from upper layer!
-    FlameTag tag;
-    if(packet->PeekPacketTag (tag))
     {
-      NS_FATAL_ERROR ("FLAME tag is not supposed to be received from upper layers");
-    }
-    FlameRtable::LookupResult result = m_rtable->Lookup(destination);
-    if (result.retransmitter == Mac48Address::GetBroadcast ())
-      m_lastBroadcast = Simulator::Now ();
-    if (m_lastBroadcast + m_broadcastInterval < Simulator::Now ())
-    {
-      result.retransmitter = Mac48Address::GetBroadcast ();
-      result.ifIndex = FlameRtable::INTERFACE_ANY;
-      m_lastBroadcast = Simulator::Now ();
-    }
-    FlameHeader flameHdr;
-    flameHdr.AddCost (0);
-    flameHdr.SetSeqno (m_myLastSeqno ++);
-    flameHdr.SetProtocol (protocolType);
-    flameHdr.SetOrigDst (destination);
-    flameHdr.SetOrigSrc (source);
-    m_stats.txBytes += packet->GetSize ();
-    packet->AddHeader (flameHdr);
-    tag.receiver = result.retransmitter;
-    if(result.retransmitter == Mac48Address::GetBroadcast ())
-      m_stats.txBroadcast ++;
-    else
-      m_stats.txUnicast ++;
-    NS_LOG_DEBUG("Source: send packet with RA = " << tag.receiver);
-    packet->AddPacketTag (tag);
-    routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
-  }
-  else
-  {
-    FlameHeader flameHdr;
-    packet->RemoveHeader (flameHdr); 
-    FlameTag tag;
-    if(!packet->RemovePacketTag (tag))
-    {
-      NS_FATAL_ERROR ("FLAME tag must exust here");
-    }
-    if(source == GetAddress ())
-    {
-      if(tag.receiver != Mac48Address::GetBroadcast ())
-        NS_LOG_DEBUG(
-            "received packet with SA = GetAddress (), RA = " << tag.receiver << 
-            ", TA = " << tag.transmitter <<
-            ", I am "<<GetAddress ());
-      m_stats.totalDropped ++;
-      return false;
-    }
-    if(destination == Mac48Address::GetBroadcast ())
-    {
-      //Broadcast always is forwarded as broadcast!
-      NS_ASSERT (HandleDataFrame(flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface));
-      FlameTag tag (Mac48Address::GetBroadcast ());
-      flameHdr.AddCost (1);
+      //Packet from upper layer!
+      FlameTag tag;
+      if (packet->PeekPacketTag (tag))
+        {
+          NS_FATAL_ERROR ("FLAME tag is not supposed to be received from upper layers");
+        }
+      FlameRtable::LookupResult result = m_rtable->Lookup (destination);
+      if (result.retransmitter == Mac48Address::GetBroadcast ())
+        {
+          m_lastBroadcast = Simulator::Now ();
+        }
+      if (m_lastBroadcast + m_broadcastInterval < Simulator::Now ())
+        {
+          result.retransmitter = Mac48Address::GetBroadcast ();
+          result.ifIndex = FlameRtable::INTERFACE_ANY;
+          m_lastBroadcast = Simulator::Now ();
+        }
+      FlameHeader flameHdr;
+      flameHdr.AddCost (0);
+      flameHdr.SetSeqno (m_myLastSeqno++);
+      flameHdr.SetProtocol (protocolType);
+      flameHdr.SetOrigDst (destination);
+      flameHdr.SetOrigSrc (source);
       m_stats.txBytes += packet->GetSize ();
       packet->AddHeader (flameHdr);
+      tag.receiver = result.retransmitter;
+      if (result.retransmitter == Mac48Address::GetBroadcast ())
+        {
+          m_stats.txBroadcast++;
+        }
+      else
+        {
+          m_stats.txUnicast++;
+        }
+      NS_LOG_DEBUG ("Source: send packet with RA = " << tag.receiver);
       packet->AddPacketTag (tag);
-      routeReply (true, packet, source, destination, FLAME_PROTOCOL, FlameRtable::INTERFACE_ANY);
-      m_stats.txBroadcast ++;
+      routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
+    }
+  else
+    {
+      FlameHeader flameHdr;
+      packet->RemoveHeader (flameHdr);
+      FlameTag tag;
+      if (!packet->RemovePacketTag (tag))
+        {
+          NS_FATAL_ERROR ("FLAME tag must exust here");
+        }
+      if (source == GetAddress ())
+        {
+          if (tag.receiver != Mac48Address::GetBroadcast ())
+            {
+              NS_LOG_DEBUG ("received packet with SA = GetAddress (), RA = " << tag.receiver << ", TA = "
+                  << tag.transmitter << ", I am " << GetAddress ());
+            }
+          m_stats.totalDropped++;
+          return false;
+        }
+      if (destination == Mac48Address::GetBroadcast ())
+        {
+          //Broadcast always is forwarded as broadcast!
+          NS_ASSERT (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface));
+          FlameTag tag (Mac48Address::GetBroadcast ());
+          flameHdr.AddCost (1);
+          m_stats.txBytes += packet->GetSize ();
+          packet->AddHeader (flameHdr);
+          packet->AddPacketTag (tag);
+          routeReply (true, packet, source, destination, FLAME_PROTOCOL, FlameRtable::INTERFACE_ANY);
+          m_stats.txBroadcast++;
+          return true;
+        }
+      else
+        {
+          if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface))
+            {
+              return false;
+            }
+          FlameRtable::LookupResult result = m_rtable->Lookup (destination);
+          if (tag.receiver != Mac48Address::GetBroadcast ())
+            {
+              if (result.retransmitter == Mac48Address::GetBroadcast ())
+                {
+                  NS_LOG_DEBUG ("unicast packet dropped, because no route! I am " << GetAddress ()
+                      << ", RA = " << tag.receiver << ", TA = " << tag.transmitter);
+                  m_stats.totalDropped++;
+                  return false;
+                }
+            }
+          tag.receiver = result.retransmitter;
+          if (result.retransmitter == Mac48Address::GetBroadcast ())
+            {
+              m_stats.txBroadcast++;
+            }
+          else
+            {
+              m_stats.txUnicast++;
+            }
+          m_stats.txBytes += packet->GetSize ();
+          flameHdr.AddCost (1);
+          packet->AddHeader (flameHdr);
+          packet->AddPacketTag (tag);
+          routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
+          return true;
+        }
       return true;
     }
-    else
-    {
-      if(HandleDataFrame(flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface))
-        return false;
-      FlameRtable::LookupResult result = m_rtable->Lookup(destination);
-      if(tag.receiver != Mac48Address::GetBroadcast ())
-      {
-        if(result.retransmitter == Mac48Address::GetBroadcast ())
-        {
-          NS_LOG_DEBUG("unicast packet dropped, because no route! I am "<<GetAddress () << 
-            ", RA = " << tag.receiver << 
-            ", TA = " << tag.transmitter);
-          m_stats.totalDropped ++;
-          return false;
-        }
-      }
-      tag.receiver = result.retransmitter;
-      if(result.retransmitter == Mac48Address::GetBroadcast ())
-        m_stats.txBroadcast ++;
-      else
-        m_stats.txUnicast ++;
-      m_stats.txBytes += packet->GetSize ();
-      flameHdr.AddCost (1);
-      packet->AddHeader (flameHdr);
-      packet->AddPacketTag (tag);
-      routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
-      return true;
-    }
-    return true;
-  }
   return false;
 }
 bool
 FlameProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
-      const Mac48Address destination, Ptr<Packet>  packet, uint16_t&  protocolType)
+    const Mac48Address destination, Ptr<Packet> packet, uint16_t& protocolType)
 {
   //Filter seqno:
-  if(source == GetAddress ())
-  {
-    NS_LOG_DEBUG("Dropped my own frame!");
-    return false;
-  }
+  if (source == GetAddress ())
+    {
+      NS_LOG_DEBUG ("Dropped my own frame!");
+      return false;
+    }
   FlameTag tag;
-  if(!packet->RemovePacketTag (tag))
-  {
-    NS_FATAL_ERROR ("FLAME tag must exist when packet is coming to protocol");
-  }
+  if (!packet->RemovePacketTag (tag))
+    {
+      NS_FATAL_ERROR ("FLAME tag must exist when packet is coming to protocol");
+    }
   //TODO: send path update
   FlameHeader flameHdr;
   packet->RemoveHeader (flameHdr);
-  NS_ASSERT(protocolType == FLAME_PROTOCOL);
+  NS_ASSERT (protocolType == FLAME_PROTOCOL);
   protocolType = flameHdr.GetProtocol ();
-  return (!HandleDataFrame(flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface));
+  return (!HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface));
 }
 bool
 FlameProtocol::Install (Ptr<MeshPointDevice> mp)
 {
   m_mp = mp;
   std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces ();
-  for (std::vector<Ptr<NetDevice> >::const_iterator i = interfaces.begin (); i != interfaces.end(); i++)
+  for (std::vector<Ptr<NetDevice> >::const_iterator i = interfaces.begin (); i != interfaces.end (); i++)
     {
       // Checking for compatible net device
       Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice> ();
       if (wifiNetDev == 0)
-        return false;
-      Ptr<MeshWifiInterfaceMac>  mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
+        {
+          return false;
+        }
+      Ptr<MeshWifiInterfaceMac> mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
       if (mac == 0)
-        return false;
+        {
+          return false;
+        }
       // Installing plugins:
       Ptr<FlameProtocolMac> flameMac = Create<FlameProtocolMac> (wifiNetDev->GetIfIndex (), this);
       m_interfaces[wifiNetDev->GetIfIndex ()] = flameMac;
@@ -286,35 +310,38 @@
   return m_address;
 }
 bool
-FlameProtocol::HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromInterface)
+FlameProtocol::HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr,
+    Mac48Address receiver, uint32_t fromInterface)
 {
-  if(source == GetAddress ())
-    return true;
+  if (source == GetAddress ())
+    {
+      return true;
+    }
   FlameRtable::LookupResult result = m_rtable->Lookup (source);
   if (result.retransmitter == Mac48Address::GetBroadcast ())
-  {
-    m_rtable->AddPath (source, receiver, fromInterface, flameHdr.GetCost (), flameHdr.GetSeqno ());
-    return false;
-  }
-  if(result.seqnum >= seqno)
-    return true;
+    {
+      m_rtable->AddPath (source, receiver, fromInterface, flameHdr.GetCost (), flameHdr.GetSeqno ());
+      return false;
+    }
+  if (result.seqnum >= seqno)
+    {
+      return true;
+    }
   if (flameHdr.GetCost () > m_maxCost)
-  {
-    m_stats.droppedTtl ++;
-    return true;
-  }
+    {
+      m_stats.droppedTtl++;
+      return true;
+    }
   m_rtable->AddPath (source, receiver, fromInterface, flameHdr.GetCost (), flameHdr.GetSeqno ());
   return false;
 }
 //Statistics:
 FlameProtocol::Statistics::Statistics () :
-  txUnicast (0),
-  txBroadcast (0),
-  txBytes (0),
-  droppedTtl (0),
-  totalDropped (0)
-{}
-void FlameProtocol::Statistics::Print (std::ostream & os) const
+  txUnicast (0), txBroadcast (0), txBytes (0), droppedTtl (0), totalDropped (0)
+{
+}
+void
+FlameProtocol::Statistics::Print (std::ostream & os) const
 {
   os << "<Statistics "
     "txUnicast=\"" << txUnicast << "\" "
@@ -323,25 +350,28 @@
     "droppedTtl=\"" << droppedTtl << "\" "
     "totalDropped=\"" << totalDropped << "\"/>\n";
 }
-
 void
 FlameProtocol::Report (std::ostream & os) const
 {
   os << "<Flame "
     "address=\"" << m_address << "\"\n"
     "broadcastInterval=\"" << m_broadcastInterval.GetSeconds () << "\"\n"
-    "maxCost=\"" << (uint16_t)m_maxCost << "\">\n";
+    "maxCost=\"" << (uint16_t) m_maxCost << "\">\n";
   m_stats.Print (os);
-  for(FlamePluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
-    plugin->second->Report(os);
+  for (FlamePluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++)
+    {
+      plugin->second->Report (os);
+    }
   os << "</Flame>\n";
 }
 void
 FlameProtocol::ResetStats ()
 {
   m_stats = Statistics ();
-  for(FlamePluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++)
-    plugin->second->ResetStats ();
+  for (FlamePluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin++)
+    {
+      plugin->second->ResetStats ();
+    }
 }
 
 } //namespace flame
--- a/src/devices/mesh/flame/flame-protocol.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-protocol.h	Wed Jul 22 14:52:42 2009 +0400
@@ -31,21 +31,23 @@
 
 /**
  * \ingroup mesh
- * \defgroup flame FLAME 
- * 
+ * \defgroup flame FLAME
+ *
  * \brief Forwarding LAyer for MEshing protocol
- * 
- * Simple L2.5 mesh routing protocol developed by 
+ *
+ * Simple L2.5 mesh routing protocol developed by
  * Herman Elfrink <herman.elfrink@ti-wmc.nl> and presented in
  * "Easy Wireless: broadband ad-hoc networking for emergency services"
- * by Maurits de Graaf et. al. at The Sixth Annual Mediterranean Ad Hoc 
+ * by Maurits de Graaf et. al. at The Sixth Annual Mediterranean Ad Hoc
  * Networking WorkShop, Corfu, Greece, June 12-15, 2007
  *
- * see also Linux kernel mailing list discussion at 
+ * see also Linux kernel mailing list discussion at
  * http://lkml.org/lkml/2006/5/23/82
  */
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 /**
  * \ingroup flame
  * \brief Transmitter and receiver addresses
@@ -57,10 +59,10 @@
   Mac48Address  transmitter;
   /// Receiver of the packet:
   Mac48Address  receiver;
-  
+
   FlameTag (Mac48Address a = Mac48Address ()) :
     receiver (a){}
-  
+
   ///\name Inherited from Tag
   //\{
   static  TypeId  GetTypeId ();
@@ -83,19 +85,19 @@
   FlameProtocol ();
   ~FlameProtocol ();
   void DoDispose ();
-  
+
   /// Route request, inherited from MeshL2RoutingProtocol
   bool RequestRoute (uint32_t  sourceIface, const Mac48Address source, const Mac48Address destination,
       Ptr<const Packet>  packet, uint16_t  protocolType, RouteReplyCallback  routeReply);
   /// Cleanup flame headers!
   bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
       const Mac48Address destination, Ptr<Packet>  packet, uint16_t&  protocolType);
-  /** 
-   * \brief Install FLAME on given mesh point. 
-   * 
+  /**
+   * \brief Install FLAME on given mesh point.
+   *
    * Installing protocol cause installing its interface MAC plugins.
-   *  
-   * Also MP aggregates all installed protocols, FLAME protocol can be accessed 
+   *
+   * Also MP aggregates all installed protocols, FLAME protocol can be accessed
    * via MeshPointDevice::GetObject<flame::FlameProtocol>();
    */
   bool Install (Ptr<MeshPointDevice>);
@@ -108,7 +110,7 @@
   static const uint16_t FLAME_PROTOCOL = 0x4040;
   /**
    * \brief Handles a packet: adds a routing information and drops packets by TTL or Seqno
-   * 
+   *
    * \return true if packet shall be dropped
    */
   bool HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromIface);
--- a/src/devices/mesh/flame/flame-rtable.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-rtable.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -23,49 +23,45 @@
 #include "ns3/log.h"
 
 #include "flame-rtable.h"
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 
 NS_LOG_COMPONENT_DEFINE ("FlameRtable");
-  
+
 NS_OBJECT_ENSURE_REGISTERED (FlameRtable);
 
 TypeId
 FlameRtable::GetTypeId ()
 {
-  static TypeId tid = TypeId ("ns3::flame::FlameRtable")
-    .SetParent<Object> ()
-    .AddConstructor<FlameRtable> ()
-    .AddAttribute ("lifetime", "The lifetime of the routing enrty",
-        TimeValue (Seconds (120)),
-        MakeTimeAccessor (&FlameRtable::m_lifetime),
-        MakeTimeChecker ()
-        );
+  static TypeId tid =
+      TypeId ("ns3::flame::FlameRtable")
+      .SetParent<Object> () .AddConstructor<FlameRtable> ()
+      .AddAttribute ( "lifetime",
+                      "The lifetime of the routing enrty",
+                      TimeValue (Seconds (120)), MakeTimeAccessor (
+                          &FlameRtable::m_lifetime),
+                      MakeTimeChecker ()
+                      )
+                      ;
   return tid;
 }
-
-FlameRtable::FlameRtable ()
-  : m_lifetime (Seconds (120))
-{}
-
+FlameRtable::FlameRtable () :
+  m_lifetime (Seconds (120))
+{
+}
 FlameRtable::~FlameRtable ()
 {
 }
-
 void
 FlameRtable::DoDispose ()
 {
   m_routes.clear ();
 }
-
 void
-FlameRtable::AddPath (
-  const Mac48Address destination,
-  const Mac48Address retransmitter,
-  const uint32_t interface,
-  const uint8_t cost,
-  const uint16_t seqnum
-)
+FlameRtable::AddPath (const Mac48Address destination, const Mac48Address retransmitter,
+    const uint32_t interface, const uint8_t cost, const uint16_t seqnum)
 {
   std::map<Mac48Address, Route>::iterator i = m_routes.find (destination);
   if (i == m_routes.end ())
@@ -74,74 +70,76 @@
       newroute.cost = cost;
       newroute.retransmitter = retransmitter;
       newroute.interface = interface;
-      newroute.whenExpire = Simulator::Now() + m_lifetime;
+      newroute.whenExpire = Simulator::Now () + m_lifetime;
       newroute.seqnum = seqnum;
       m_routes[destination] = newroute;
       return;
     }
   i->second.seqnum = seqnum;
-  NS_ASSERT (i != m_routes.end());
+  NS_ASSERT (i != m_routes.end ());
   if (i->second.cost < cost)
-    return;
+    {
+      return;
+    }
   i->second.retransmitter = retransmitter;
   i->second.interface = interface;
   i->second.cost = cost;
-  i->second.whenExpire = Simulator::Now() + m_lifetime;
+  i->second.whenExpire = Simulator::Now () + m_lifetime;
 }
 FlameRtable::LookupResult
 FlameRtable::Lookup (Mac48Address destination)
 {
   std::map<Mac48Address, Route>::iterator i = m_routes.find (destination);
   if (i == m_routes.end ())
-    return LookupResult ();
+    {
+      return LookupResult ();
+    }
   if ((i->second.whenExpire < Simulator::Now ()))
     {
       NS_LOG_DEBUG ("Route has expired, sorry.");
       m_routes.erase (i);
-      return LookupResult();
+      return LookupResult ();
     }
   return LookupResult (i->second.retransmitter, i->second.interface, i->second.cost, i->second.seqnum);
 }
-bool FlameRtable::LookupResult::operator==(const FlameRtable::LookupResult & o) const
+bool
+FlameRtable::LookupResult::operator== (const FlameRtable::LookupResult & o) const
 {
-  return (retransmitter == o.retransmitter
-      && ifIndex == o.ifIndex 
-      && cost  == o.cost
-      && seqnum  == o.seqnum
-    );
+  return (retransmitter == o.retransmitter && ifIndex == o.ifIndex && cost == o.cost && seqnum == o.seqnum);
 }
 
-bool FlameRtable::LookupResult::IsValid() const
+bool
+FlameRtable::LookupResult::IsValid () const
 {
-  return !( retransmitter == Mac48Address::GetBroadcast ()
-        &&  ifIndex == INTERFACE_ANY
-        &&  cost == MAX_COST
-        &&  seqnum == 0
-      );
+  return !(retransmitter == Mac48Address::GetBroadcast () && ifIndex == INTERFACE_ANY && cost == MAX_COST
+      && seqnum == 0);
 }
 
-
 #ifdef RUN_SELF_TESTS
 /// Unit test for FlameRtable
-class FlameRtableTest : public Test 
+class FlameRtableTest : public Test
 {
 public:
   FlameRtableTest ();
-  virtual bool RunTests(); 
-  
+  virtual bool
+  RunTests ();
+
 private:
   /// Test Add apth and lookup path;
-  void TestLookup ();
+  void
+  TestLookup ();
   /**
    * \name Test add path and try to lookup after entry has expired
    * \{
    */
-  void TestAddPath ();
-  void TestExpire ();
+  void
+  TestAddPath ();
+  void
+  TestExpire ();
   ///\}
 private:
   bool result;
-  
+
   Mac48Address dst;
   Mac48Address hop;
   uint32_t iface;
@@ -153,50 +151,49 @@
 /// Test instance
 static FlameRtableTest g_FlameRtableTest;
 
-FlameRtableTest::FlameRtableTest ()  : Test ("Mesh/flame/FlameRtable"), 
-  result(true),
-  dst ("01:00:00:01:00:01"),
-  hop ("01:00:00:01:00:03"),
-  iface (8010),
-  cost (10),
-  seqnum (1)
+FlameRtableTest::FlameRtableTest () :
+  Test ("Mesh/flame/FlameRtable"), result (true), dst ("01:00:00:01:00:01"), hop ("01:00:00:01:00:03"),
+      iface (8010), cost (10), seqnum (1)
 {
 }
 
-void FlameRtableTest::TestLookup ()
+void
+FlameRtableTest::TestLookup ()
 {
   FlameRtable::LookupResult correct (hop, iface, cost, seqnum);
-  
+
   table->AddPath (dst, hop, iface, cost, seqnum);
   NS_TEST_ASSERT (table->Lookup (dst) == correct);
 }
 
-void FlameRtableTest::TestAddPath ()
+void
+FlameRtableTest::TestAddPath ()
 {
   table->AddPath (dst, hop, iface, cost, seqnum);
 }
 
-void FlameRtableTest::TestExpire ()
+void
+FlameRtableTest::TestExpire ()
 {
   // this is assumed to be called when path records are already expired
   FlameRtable::LookupResult correct (hop, iface, cost, seqnum);
-  NS_TEST_ASSERT (! table->Lookup (dst).IsValid ());
+  NS_TEST_ASSERT (!table->Lookup (dst).IsValid ());
 }
-bool FlameRtableTest::RunTests ()
+bool
+FlameRtableTest::RunTests ()
 {
   table = CreateObject<FlameRtable> ();
-  
-  Simulator::Schedule (Seconds (0), & FlameRtableTest::TestLookup, this);
-  Simulator::Schedule (Seconds (1), & FlameRtableTest::TestAddPath, this);
-  Simulator::Schedule (Seconds (122), & FlameRtableTest::TestExpire, this);
-  
+
+  Simulator::Schedule (Seconds (0), &FlameRtableTest::TestLookup, this);
+  Simulator::Schedule (Seconds (1), &FlameRtableTest::TestAddPath, this);
+  Simulator::Schedule (Seconds (122), &FlameRtableTest::TestExpire, this);
+
   Simulator::Run ();
   Simulator::Destroy ();
-  
+
   return result;
 }
 
 #endif // RUN_SELF_TESTS
-
 } //namespace flame
 } //namespace ns3
--- a/src/devices/mesh/flame/flame-rtable.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/flame/flame-rtable.h	Wed Jul 22 14:52:42 2009 +0400
@@ -26,11 +26,13 @@
 #include "ns3/object.h"
 #include "ns3/mac48-address.h"
 
-namespace ns3 {
-namespace flame {
+namespace ns3
+{
+namespace flame
+{
 /**
  * \ingroup flame
- * 
+ *
  * \brief Routing table for FLAME
  */
 class FlameRtable : public Object
@@ -40,7 +42,7 @@
   const static uint32_t INTERFACE_ANY = 0xffffffff;
   /// Maximum (the best?) path cost
   const static uint32_t MAX_COST = 0xff;
-  
+
   /// Route lookup result, return type of LookupXXX methods
   struct LookupResult
   {
@@ -48,9 +50,9 @@
     uint32_t ifIndex;
     uint8_t  cost;
     uint16_t seqnum;
-    LookupResult(Mac48Address r = Mac48Address::GetBroadcast (), 
-                 uint32_t i = INTERFACE_ANY, 
-                 uint8_t  c = MAX_COST, 
+    LookupResult(Mac48Address r = Mac48Address::GetBroadcast (),
+                 uint32_t i = INTERFACE_ANY,
+                 uint8_t  c = MAX_COST,
                  uint16_t s = 0)
       : retransmitter (r),
         ifIndex (i),
@@ -58,7 +60,7 @@
         seqnum (s)
     {
     }
-    /// True for valid route 
+    /// True for valid route
     bool IsValid() const;
     /// Compare route lookup results, used by tests
     bool operator==(const LookupResult & o) const;
@@ -68,7 +70,7 @@
   FlameRtable ();
   ~FlameRtable ();
   void DoDispose ();
-  
+
   /// Add path
   void AddPath (
     const Mac48Address destination,
--- a/src/devices/mesh/mesh-l2-routing-protocol.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/mesh-l2-routing-protocol.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -28,7 +28,7 @@
 namespace ns3
 {
 
-NS_OBJECT_ENSURE_REGISTERED ( MeshL2RoutingProtocol);
+NS_OBJECT_ENSURE_REGISTERED (MeshL2RoutingProtocol);
 
 TypeId
 MeshL2RoutingProtocol::GetTypeId (void)
--- a/src/devices/mesh/mesh-l2-routing-protocol.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/mesh-l2-routing-protocol.h	Wed Jul 22 14:52:42 2009 +0400
@@ -26,7 +26,8 @@
 #include "ns3/mac48-address.h"
 #include "ns3/packet.h"
 
-namespace ns3 {
+namespace ns3
+{
 
 class Packet;
 class MeshPointDevice;
@@ -34,11 +35,11 @@
 /**
  * \ingroup mesh
  *
- * \brief Interface for L2 mesh routing protocol and mesh point communication. 
+ * \brief Interface for L2 mesh routing protocol and mesh point communication.
  *
  * Every mesh routing protocol must implement this interface. Each mesh point (MeshPointDevice) is supposed
- * to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutingProtocol ().  
- * 
+ * to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutingProtocol ().
+ *
  * This interface is similar to ipv4 routiong protocol base class.
  */
 class MeshL2RoutingProtocol : public Object
@@ -50,24 +51,24 @@
   virtual ~MeshL2RoutingProtocol ();
   /**
    * Callback to be invoked when route discovery  procedure is completed.
-   * 
-   * \param flag        indicating whether a route was actually found and all needed information is 
+   *
+   * \param flag        indicating whether a route was actually found and all needed information is
    *                    added to the packet succesfully
-   *                    
+   *
    * \param packet      for which the route was resolved. All routing information for MAC layer
-   *                    must be stored in proper tags (like in case of HWMP, when WifiMacHeader 
+   *                    must be stored in proper tags (like in case of HWMP, when WifiMacHeader
    *                    needs address of next hop), or must be added as a packet header (if MAC
-   *                    does not need any additional information). So, the packet is returned back 
-   *                    to MeshPointDevice looks like a pure packet with ethernet header 
+   *                    does not need any additional information). So, the packet is returned back
+   *                    to MeshPointDevice looks like a pure packet with ethernet header
    *                    (i.e data + src +dst + protocol). The only special information addressed
    *                    to MeshPointDevice is an outcoming interface ID.
-   *                    
+   *
    * \param src         source address of the packet
-   * 
+   *
    * \param dst         destiation address of the packet
-   * 
+   *
    * \param protocol    ethernet 'Protocol' field, needed to form a proper MAC-layer header
-   * 
+   *
    * \param uint32_t    outcoming interface to use or 0xffffffff if packet should be sent by ALL interfaces
    */
   typedef Callback<void,/* return type */
@@ -76,11 +77,11 @@
           Mac48Address,/* src */
           Mac48Address,/* dst */
           uint16_t,    /* protocol */
-          uint32_t     /* out interface ID */ 
+          uint32_t     /* out interface ID */
           > RouteReplyCallback;
   /**
    * Request routing information, all packets must go through this request.
-   * 
+   *
    * Note that route discovery works async. -- RequestRoute returns immediately, while
    * reply callback will be called when routing information will be available.
    * \return true if valid route is already known
@@ -89,13 +90,13 @@
    * \param destination   destination address
    * \param packet        the packet to be resolved (needed the whole packet, because
    *                      routing information is added as tags or headers). The packet
-   *                      will be returned to reply callback. 
+   *                      will be returned to reply callback.
    * \param protocolType  protocol ID, needed to form a proper MAC-layer header
-   * \param routeReply    callback to be invoked after route discovery procedure, supposed 
+   * \param routeReply    callback to be invoked after route discovery procedure, supposed
    *                      to really send packet using routing information.
    */
-  virtual bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, 
-      Ptr<const Packet> packet, uint16_t  protocolType, RouteReplyCallback routeReply ) = 0;
+  virtual bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr<
+      const Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply) = 0;
   /**
    * \brief When packet is ready to go to upper layer, protocol must
    * remove all its information: tags, header, etc. So,
@@ -110,12 +111,14 @@
    * \attention protocol type is passed by reference, because may be
    * changed
    */
-  virtual bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
-      const Mac48Address destination, Ptr<Packet>  packet, uint16_t &  protocolType) = 0;
+  virtual bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr<
+      Packet> packet, uint16_t & protocolType) = 0;
   /// Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
-  void SetMeshPoint (Ptr<MeshPointDevice> mp);
+  void
+  SetMeshPoint (Ptr<MeshPointDevice> mp);
   /// Each mesh protocol must be installed on the mesh point to work.
-  Ptr<MeshPointDevice> GetMeshPoint () const; 
+  Ptr<MeshPointDevice>
+  GetMeshPoint () const;
 protected:
   /// Host mesh point
   Ptr<MeshPointDevice> m_mp;
--- a/src/devices/mesh/mesh-point-device.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/mesh-point-device.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -32,7 +32,7 @@
 namespace ns3
 {
 
-NS_OBJECT_ENSURE_REGISTERED ( MeshPointDevice);
+NS_OBJECT_ENSURE_REGISTERED (MeshPointDevice);
 
 TypeId
 MeshPointDevice::GetTypeId ()
--- a/src/devices/mesh/mesh-point-device.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/mesh-point-device.h	Wed Jul 22 14:52:42 2009 +0400
@@ -19,7 +19,6 @@
  *          Pavel Boyko <boyko@iitp.ru>
  */
 
-
 #ifndef L2ROUTING_NET_DEVICE_H
 #define L2ROUTING_NET_DEVICE_H
 
@@ -28,23 +27,24 @@
 #include "ns3/bridge-channel.h"
 #include "ns3/mesh-l2-routing-protocol.h"
 
-namespace ns3 {
-  
+namespace ns3
+{
+
 class Node;
 /**
  * \ingroup mesh
  *
- * \brief Virtual net device modeling mesh point. 
+ * \brief Virtual net device modeling mesh point.
  *
  * Mesh point is a virtual net device which is responsible for
- *   - Aggreagating and coordinating 1..* real devices -- mesh interfaces, see MeshInterfaceDevice class. 
- *   - Hosting all mesh-related level 2 protocols. 
- * 
+ *   - Aggreagating and coordinating 1..* real devices -- mesh interfaces, see MeshInterfaceDevice class.
+ *   - Hosting all mesh-related level 2 protocols.
+ *
  * One of hosted L2 protocols must inplement L2RoutingProtocol interface and is used for packets forwarding.
  *
- * From the level 3 point of view MeshPointDevice is similar to BridgeNetDevice, but the packets, 
+ * From the level 3 point of view MeshPointDevice is similar to BridgeNetDevice, but the packets,
  * which going through may be changed (because L2 protocols may require their own headers or tags).
- * 
+ *
  * Attributes: TODO
  */
 class MeshPointDevice : public NetDevice
@@ -56,13 +56,13 @@
   MeshPointDevice ();
   /// D-tor
   virtual ~MeshPointDevice ();
-  
-  ///\name Interfaces 
+
+  ///\name Interfaces
   //\{
   /**
    * \brief Attach new interface to the station. Interface must support 48-bit MAC address and SendFrom method.
-   * 
-   * \attention Only MeshPointDevice can have IP address, but not individual interfaces. 
+   *
+   * \attention Only MeshPointDevice can have IP address, but not individual interfaces.
    */
   void AddInterface (Ptr<NetDevice> port);
   /**
@@ -79,7 +79,7 @@
    */
   std::vector<Ptr<NetDevice> > GetInterfaces () const;
   //\}
-  
+
   ///\name Protocols
   //\{
   /// Register routing protocol to be used. Protocol must be alredy installed on this mesh point.
@@ -87,7 +87,7 @@
   /// Access current routing protocol
   Ptr<MeshL2RoutingProtocol> GetRoutingProtocol() const;
   //\}
-  
+
   ///\name NetDevice interface for upper layers
   //\{
   virtual void SetName (const std::string name);
@@ -118,7 +118,7 @@
   virtual Address GetMulticast (Ipv6Address addr) const;
   virtual void DoDispose ();
   //\}
-  
+
   ///\name Statistics
   //\{
   /// Print statistics counters
@@ -126,17 +126,18 @@
   /// Reset statistics counters
   void ResetStats ();
   //\}
-  
+
 private:
   /// Receive packet from interface
   void ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
                           Address const &source, Address const &destination, PacketType packetType);
-  /// Forward packet down to interfaces 
+  /// Forward packet down to interfaces
   void Forward (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet,
-                uint16_t protocol, const Mac48Address src, const Mac48Address dst);
+                uint16_t protocol, const Mac48Address src,
+      const Mac48Address dst);
   /**
    * Response callback for L2 routing protocol. This will be executed when routing information is ready.
-   * 
+   *
    * \param success     True is route found. TODO: diagnose routing errors
    * \param packet      Packet to send
    * \param src         Source MAC address
@@ -144,8 +145,10 @@
    * \param protocol    Protocol ID
    * \param outIface    Interface to use (ID) for send (decided by routing protocol). All interfaces will be used if outIface = 0xffffffff
    */
-  void DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t iface);
-  
+  void
+  DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol,
+      uint32_t iface);
+
 private:
   /// Receive action
   NetDevice::ReceiveCallback   m_rxCallback;
@@ -159,13 +162,13 @@
   std::string m_name;
   /// List of interfaces
   std::vector< Ptr<NetDevice> > m_ifaces;
-  /// If index 
+  /// If index
   uint32_t m_ifIndex;
   /// MTU in bytes
   uint16_t m_mtu;
   /// Virtual channel for upper layers
   Ptr<BridgeChannel> m_channel;
-  
+
   /// Routing request callback
   Callback<bool,
            uint32_t,
@@ -179,15 +182,15 @@
   MeshL2RoutingProtocol::RouteReplyCallback  m_myResponse;
   /// Current routing protocol, used mainly by GetRoutingProtocol
   Ptr<MeshL2RoutingProtocol> m_routingProtocol;
-  
+
   /// Device statistics counters
-  struct Statistics 
+  struct Statistics
   {
     uint32_t unicastData;
     uint32_t unicastDataBytes;
     uint32_t broadcastData;
     uint32_t broadcastDataBytes;
-    
+
     Statistics ();
   };
   /// Counters
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Wed Jul 22 14:52:42 2009 +0400
@@ -38,7 +38,7 @@
 namespace ns3
 {
 
-NS_OBJECT_ENSURE_REGISTERED ( MeshWifiInterfaceMac);
+NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
 
 TypeId
 MeshWifiInterfaceMac::GetTypeId ()
--- a/src/devices/mesh/mesh-wifi-interface-mac.h	Wed Jul 22 13:31:31 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.h	Wed Jul 22 14:52:42 2009 +0400
@@ -1,7 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/* 
+/*
  * Copyright (c) 2009 IITP RAS
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation;
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  * Authors: Kirill Andreev <andreev@iitp.ru>
  *          Pavel Boyko <boyko@iitp.ru>
  */
@@ -34,7 +34,8 @@
 #include "ns3/mesh-wifi-interface-mac-plugin.h"
 #include "ns3/event-id.h"
 #include "qos-utils.h"
-namespace ns3 {
+namespace ns3
+{
 
 class WifiMacHeader;
 class DcaTxop;
@@ -46,23 +47,23 @@
  * \ingroup mesh
  *
  * \brief Basic MAC of mesh point Wi-Fi interface. Its function is extendable through plugins mechanism.
- * 
+ *
  * Now only three output queues are used:
  *  - beacons (PIFS and no backoff),
  *  - background traffic,
  *  - management and priority traffic.
- *  
+ *
  */
 class MeshWifiInterfaceMac : public WifiMac
 {
 public:
   /// Never forget to support typeid
-  static TypeId  GetTypeId ();
+  static TypeId GetTypeId ();
   /// C-tor
   MeshWifiInterfaceMac ();
   /// D-tor
   virtual ~MeshWifiInterfaceMac ();
-  
+
   ///\name Inherited from WifiMac
   //\{
   virtual void  SetSlot (Time slotTime);
@@ -91,7 +92,7 @@
   virtual void  SetAddress (Mac48Address address);
   virtual void  SetSsid (Ssid ssid);
   //\}
-  
+
   ///\name Each mesh point interfaces must know the mesh point address
   //\{
   void SetMeshPointAddress (Mac48Address);
@@ -105,34 +106,34 @@
   void SetBeaconInterval (Time interval);
   /// \return interval between two beacons
   Time GetBeaconInterval () const;
-  /** 
+  /**
    * \brief Next beacon frame time
-   * 
+   *
    * This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s)
-   */ 
+   */
   Time GetTbtt () const;
   /**
    * \brief Shift TBTT.
-   * 
+   *
    * This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s)
-   * 
-   * \attention User of ShiftTbtt () must take care to not shift it to the past. 
+   *
+   * \attention User of ShiftTbtt () must take care to not shift it to the past.
    */
   void ShiftTbtt (Time shift);
   //\}
-  
+
   ///\name Plugins
   //\{
   /// Install plugin. TODO return unique ID to allow unregister plugins
   void InstallPlugin (Ptr<MeshWifiInterfaceMacPlugin> plugin);
   //\}
-  
+
   /** \name Channel switching
-   * 
-   * Channel center frequency = Channel starting frequency + 5 * channel_id (MHz), 
+   *
+   * Channel center frequency = Channel starting frequency + 5 * channel_id (MHz),
    * where Starting channel frequency is standard-dependent as defined in IEEE 802.11-2007 17.3.8.3.2.
-   * 
-   * Number of channels to use must be limited elsewhere. 
+   *
+   * Number of channels to use must be limited elsewhere.
    */
   //\{
   /// Current channel Id
@@ -140,7 +141,7 @@
   /// Switch channel
   void SwitchFrequencyChannel (uint16_t new_id);
   //\}
-  
+
   /// To be used by plugins sending management frames.
   void SendManagementFrame(Ptr<Packet> frame, const WifiMacHeader& hdr);
   /// \return true if rates are supported
@@ -165,7 +166,7 @@
   void  Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
   /// Forward frame to mesh point
   virtual void ForwardUp (Ptr<Packet> packet, Mac48Address src, Mac48Address dst);
-  /// Send frame. Frame is supposed to be tagged by routing information. TODO: clarify this point 
+  /// Send frame. Frame is supposed to be tagged by routing information. TODO: clarify this point
   void  ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
   /// Send beacon
   void SendBeacon ();
@@ -175,18 +176,18 @@
   bool GetBeaconGeneration () const;
   /// Real d-tor
   virtual void DoDispose ();
-  
+
 private:
   ///\name Wifi MAC internals
   //\{
   typedef std::map<AccessClass, Ptr<DcaTxop> > Queues;
   Queues m_queues;
-  Ptr<DcaTxop>   m_beaconDca;
+  Ptr<DcaTxop> m_beaconDca;
   Ptr<WifiRemoteStationManager> m_stationManager;
-  Ptr<WifiPhy>   m_phy;
-  Callback<void, Ptr<Packet>, Mac48Address, Mac48Address>  m_upCallback;
+  Ptr<WifiPhy> m_phy;
+  Callback<void, Ptr<Packet> , Mac48Address, Mac48Address> m_upCallback;
   //\}
-  
+
   ///\name Wifi timing intervals
   //\{
   Time m_slot;
@@ -196,8 +197,8 @@
   Time m_ctsTimeout;
   Time m_eifsNoDifs;
   //\}
-  
-  ///\name Mesh timing intervals 
+
+  ///\name Mesh timing intervals
   //\{
   /// Beaconing interval.
   Time m_beaconInterval;
@@ -206,7 +207,7 @@
   /// Time for the next frame
   Time m_tbtt;
   //\}
-  
+
   /// DCF implementation
   DcfManager* m_dcfManager;
   /// Middle MAC sublayer
@@ -219,11 +220,11 @@
   Mac48Address m_mpAddress;
   /// SSID
   Ssid m_meshId;
-  
-  /// "Timer" for the next beacon 
+
+  /// "Timer" for the next beacon
   EventId m_beaconSendEvent;
-  
-  typedef std::vector< Ptr<MeshWifiInterfaceMacPlugin> > PluginList; 
+
+  typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
   /// List of all installed plugins
   PluginList m_plugins;
   Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > m_linkMetricCallback;
@@ -236,7 +237,8 @@
     uint32_t sentBytes;
     uint32_t recvFrames;
     uint32_t recvBytes;
-    void Print (std::ostream & os) const;
+    void
+    Print (std::ostream & os) const;
     Statistics ();
   };
   Statistics m_stats;