Fixed coding style in helpers and mesh
authorKirill Andreev <andreev@iitp.ru>
Wed, 22 Jul 2009 13:31:31 +0400
changeset 5128 d6e168eba404
parent 5127 c8de27730943
child 5129 5688b8da4526
Fixed coding style in helpers and mesh
src/devices/mesh/mesh-l2-routing-protocol.cc
src/devices/mesh/mesh-point-device.cc
src/devices/mesh/mesh-wifi-beacon.cc
src/devices/mesh/mesh-wifi-interface-mac.cc
src/devices/mesh/wifi-information-element.cc
src/helper/mesh-helper.cc
src/helper/mesh-interface-helper.cc
--- a/src/devices/mesh/mesh-l2-routing-protocol.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/devices/mesh/mesh-l2-routing-protocol.cc	Wed Jul 22 13:31:31 2009 +0400
@@ -25,15 +25,16 @@
 
 NS_LOG_COMPONENT_DEFINE ("MeshL2RoutingProtocol");
 
-namespace ns3 {
+namespace ns3
+{
 
-NS_OBJECT_ENSURE_REGISTERED (MeshL2RoutingProtocol);
+NS_OBJECT_ENSURE_REGISTERED ( MeshL2RoutingProtocol);
 
 TypeId
 MeshL2RoutingProtocol::GetTypeId (void)
 {
   static TypeId tid = TypeId ("ns3::MeshL2RoutingProtocol")
-                      .SetParent<Object> ();
+    .SetParent<Object> ();
   return tid;
 }
 
@@ -47,7 +48,8 @@
   m_mp = mp;
 }
 
-Ptr<MeshPointDevice> MeshL2RoutingProtocol::GetMeshPoint () const
+Ptr<MeshPointDevice>
+MeshL2RoutingProtocol::GetMeshPoint () const
 {
   return m_mp;
 }
--- a/src/devices/mesh/mesh-point-device.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/devices/mesh/mesh-point-device.cc	Wed Jul 22 13:31:31 2009 +0400
@@ -19,7 +19,6 @@
  *         Pavel Boyko <boyko@iitp.ru>
  */
 
-
 #include "ns3/node.h"
 #include "ns3/packet.h"
 #include "ns3/log.h"
@@ -30,26 +29,29 @@
 
 NS_LOG_COMPONENT_DEFINE ("MeshPointDevice");
 
-namespace ns3 {
+namespace ns3
+{
 
-NS_OBJECT_ENSURE_REGISTERED (MeshPointDevice);
+NS_OBJECT_ENSURE_REGISTERED ( MeshPointDevice);
 
 TypeId
 MeshPointDevice::GetTypeId ()
 {
   static TypeId tid = TypeId ("ns3::MeshPointDevice")
-    .SetParent<NetDevice> ()
-    .AddConstructor<MeshPointDevice> ()
-    .AddAttribute ("RoutingProtocol", "The mesh routing protocol used by this mesh point.",
-        PointerValue (),
-        MakePointerAccessor (&MeshPointDevice::GetRoutingProtocol,
-          &MeshPointDevice::SetRoutingProtocol),
-        MakePointerChecker<MeshL2RoutingProtocol> ())
-    ;
+  .SetParent<NetDevice> ()
+  .AddConstructor<MeshPointDevice> ()
+  .AddAttribute ( "RoutingProtocol",
+                  "The mesh routing protocol used by this mesh point.",
+                  PointerValue (),
+                  MakePointerAccessor (
+                      &MeshPointDevice::GetRoutingProtocol, &MeshPointDevice::SetRoutingProtocol),
+                  MakePointerChecker<
+                  MeshL2RoutingProtocol> ());
   return tid;
 }
 
-MeshPointDevice::MeshPointDevice () : m_ifIndex (0), m_mtu(1500)
+MeshPointDevice::MeshPointDevice () :
+  m_ifIndex (0), m_mtu (1500)
 {
   NS_LOG_FUNCTION_NOARGS ();
   m_channel = CreateObject<BridgeChannel> ();
@@ -64,7 +66,7 @@
 MeshPointDevice::DoDispose ()
 {
   NS_LOG_FUNCTION_NOARGS ();
-  for (std::vector< Ptr<NetDevice> >::iterator iter = m_ifaces.begin (); iter != m_ifaces.end (); iter++)
+  for (std::vector<Ptr<NetDevice> >::iterator iter = m_ifaces.begin (); iter != m_ifaces.end (); iter++)
     {
       *iter = 0;
     }
@@ -80,53 +82,53 @@
 
 void
 MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol,
-                                       Address const &src, Address const &dst, PacketType packetType)
+    Address const &src, Address const &dst, PacketType packetType)
 {
   NS_LOG_FUNCTION_NOARGS ();
   NS_LOG_DEBUG ("UID is " << packet->GetUid ());
   const Mac48Address src48 = Mac48Address::ConvertFrom (src);
   const Mac48Address dst48 = Mac48Address::ConvertFrom (dst);
   uint16_t& realProtocol = protocol;
-  NS_LOG_DEBUG ("SRC="<<src48<<", DST = "<<dst48<<", I am: "<<m_address);
+  NS_LOG_DEBUG ("SRC=" << src48 << ", DST = " << dst48 << ", I am: " << m_address);
   if (!m_promiscRxCallback.IsNull ())
-  {
-    m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
-  }
-  if(dst48.IsGroup ())
-  {
-    Ptr<Packet> packet_copy = packet->Copy ();
-    if(m_removeRoutingStuff (incomingPort->GetIfIndex(), src48, dst48, packet_copy, realProtocol))
+    {
+      m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
+    }
+  if (dst48.IsGroup ())
     {
-      m_rxCallback (this, packet_copy, realProtocol, src);
-      Forward (incomingPort, packet, protocol, src48, dst48);
-      
-      m_rxStats.broadcastData ++;
-      m_rxStats.broadcastDataBytes += packet->GetSize ();
+      Ptr<Packet> packet_copy = packet->Copy ();
+      if (m_removeRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
+        {
+          m_rxCallback (this, packet_copy, realProtocol, src);
+          Forward (incomingPort, packet, protocol, src48, dst48);
+
+          m_rxStats.broadcastData++;
+          m_rxStats.broadcastDataBytes += packet->GetSize ();
+        }
+      return;
     }
-    return;
-  }
-  if(dst48 == m_address)
-  {
-    Ptr<Packet> packet_copy = packet->Copy ();
-    if(m_removeRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
+  if (dst48 == m_address)
     {
-      m_rxCallback (this, packet_copy, realProtocol, src);
-      
-      m_rxStats.unicastData ++;
-      m_rxStats.unicastDataBytes += packet->GetSize ();
+      Ptr<Packet> packet_copy = packet->Copy ();
+      if (m_removeRoutingStuff (incomingPort->GetIfIndex (), src48, dst48, packet_copy, realProtocol))
+        {
+          m_rxCallback (this, packet_copy, realProtocol, src);
+
+          m_rxStats.unicastData++;
+          m_rxStats.unicastDataBytes += packet->GetSize ();
+        }
+      return;
     }
-    return;
-  }
   else
     Forward (incomingPort, packet->Copy (), protocol, src48, dst48);
 }
 
 void
-MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet,
-                             uint16_t protocol, const Mac48Address src, const Mac48Address dst)
+MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet, uint16_t protocol,
+    const Mac48Address src, const Mac48Address dst)
 {
   // pass through routing protocol
-  m_requestRoute (inport->GetIfIndex(), src, dst, packet, protocol, m_myResponse);
+  m_requestRoute (inport->GetIfIndex (), src, dst, packet, protocol, m_myResponse);
 }
 
 void
@@ -172,10 +174,10 @@
 }
 
 void
-MeshPointDevice::SetAddress (Address a) 
+MeshPointDevice::SetAddress (Address a)
 {
   NS_LOG_WARN ("Manual changing mesh point address can cause routing errors.");
-  m_address = Mac48Address::ConvertFrom(a);
+  m_address = Mac48Address::ConvertFrom (a);
 }
 
 bool
@@ -249,7 +251,6 @@
   return false;
 }
 
-
 bool
 MeshPointDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
 {
@@ -258,7 +259,8 @@
 }
 
 bool
-MeshPointDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
+MeshPointDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest,
+    uint16_t protocolNumber)
 {
   const Mac48Address src48 = Mac48Address::ConvertFrom (src);
   const Mac48Address dst48 = Mac48Address::ConvertFrom (dest);
@@ -327,13 +329,13 @@
 Ptr<NetDevice>
 MeshPointDevice::GetInterface (uint32_t n) const
 {
-  for (std::vector< Ptr<NetDevice> >::const_iterator i = m_ifaces.begin (); i != m_ifaces.end (); i ++)
-  {
-    if ((*i)->GetIfIndex() == n)
+  for (std::vector<Ptr<NetDevice> >::const_iterator i = m_ifaces.begin (); i != m_ifaces.end (); i++)
     {
-      return (*i);
+      if ((*i)->GetIfIndex () == n)
+        {
+          return (*i);
+        }
     }
-  }
   NS_FATAL_ERROR ("Mesh point interface is not found by index");
   return 0;
 }
@@ -346,36 +348,38 @@
 MeshPointDevice::AddInterface (Ptr<NetDevice> iface)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  
+
   NS_ASSERT (iface != this);
   if (!Mac48Address::IsMatchingType (iface->GetAddress ()))
-  {
-    NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be used as a mesh point interface.");
-  }
+    {
+      NS_FATAL_ERROR ("Device does not support eui 48 addresses: cannot be used as a mesh point interface.");
+    }
   if (!iface->SupportsSendFrom ())
-  {
-    NS_FATAL_ERROR ("Device does not support SendFrom: cannot be used as a mesh point interface.");
-  }
-  
+    {
+      NS_FATAL_ERROR ("Device does not support SendFrom: cannot be used as a mesh point interface.");
+    }
+
   // Mesh point has MAC address of it's first interface
   if (m_ifaces.empty ())
-  {
-    m_address = Mac48Address::ConvertFrom (iface->GetAddress ());
-  }
-  Ptr<WifiNetDevice>  wifiNetDev = iface->GetObject<WifiNetDevice> ();
+    {
+      m_address = Mac48Address::ConvertFrom (iface->GetAddress ());
+    }
+  Ptr<WifiNetDevice> wifiNetDev = iface->GetObject<WifiNetDevice> ();
   if (wifiNetDev == 0)
-  {
-    NS_FATAL_ERROR ("Device is not a WiFi NIC: cannot be used as a mesh point interface.");
-  }
-  Ptr<MeshWifiInterfaceMac>  ifaceMac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
+    {
+      NS_FATAL_ERROR ("Device is not a WiFi NIC: cannot be used as a mesh point interface.");
+    }
+  Ptr<MeshWifiInterfaceMac> ifaceMac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
   if (ifaceMac == 0)
-  {
-    NS_FATAL_ERROR ("WiFi device doesn't have correct MAC installed: cannot be used as a mesh point interface.");
-  }
+    {
+      NS_FATAL_ERROR (
+          "WiFi device doesn't have correct MAC installed: cannot be used as a mesh point interface.");
+    }
   ifaceMac->SetMeshPointAddress (m_address);
-  
+
   // Receive frames from this interface
-  m_node->RegisterProtocolHandler (MakeCallback (&MeshPointDevice::ReceiveFromDevice, this), 0, iface, /*promiscuous = */true);
+  m_node->RegisterProtocolHandler (MakeCallback (&MeshPointDevice::ReceiveFromDevice, this), 0, iface, /*promiscuous = */
+      true);
   m_ifaces.push_back (iface);
   m_channel->AddChannel (iface->GetChannel ());
 }
@@ -388,9 +392,10 @@
 MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol)
 {
   NS_LOG_FUNCTION_NOARGS ();
-  
-  NS_ASSERT_MSG (PeekPointer(protocol->GetMeshPoint()) == this, "Routing protocol must be installed on mesh point to be useful.");
-  
+
+  NS_ASSERT_MSG (PeekPointer (protocol->GetMeshPoint ()) == this,
+      "Routing protocol must be installed on mesh point to be useful.");
+
   m_routingProtocol = protocol;
   m_requestRoute = MakeCallback (&MeshL2RoutingProtocol::RequestRoute, protocol);
   m_removeRoutingStuff = MakeCallback (&MeshL2RoutingProtocol::RemoveRoutingStuff, protocol);
@@ -404,65 +409,64 @@
 }
 
 void
-MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t outIface)
+MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst,
+    uint16_t protocol, uint32_t outIface)
 {
   if (!success)
     {
       NS_LOG_DEBUG ("Resolve failed");
       return;
     }
-  
+
   // Count statistics
-  Statistics * stats = ((src == m_address) ? & m_txStats : & m_fwdStats);
-  
+  Statistics * stats = ((src == m_address) ? &m_txStats : &m_fwdStats);
+
   if (dst.IsBroadcast ())
     {
-      stats->broadcastData ++;
+      stats->broadcastData++;
       stats->broadcastDataBytes += packet->GetSize ();
     }
   else
     {
-      stats->unicastData ++;
+      stats->unicastData++;
       stats->unicastDataBytes += packet->GetSize ();
     }
-  
+
   // Send
   if (outIface != 0xffffffff)
-  {
-    GetInterface (outIface)->SendFrom(packet, src, dst, protocol);
-  }
+    {
+      GetInterface (outIface)->SendFrom (packet, src, dst, protocol);
+    }
   else
-  {
-    for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin (); i != m_ifaces.end(); i++)
     {
-      (*i) -> SendFrom (packet->Copy (), src, dst, protocol);
+      for (std::vector<Ptr<NetDevice> >::iterator i = m_ifaces.begin (); i != m_ifaces.end (); i++)
+        {
+          (*i) -> SendFrom (packet->Copy (), src, dst, protocol);
+        }
     }
-  }
 }
 MeshPointDevice::Statistics::Statistics () :
-  unicastData (0),
-  unicastDataBytes (0),
-  broadcastData (0),
-  broadcastDataBytes (0)
-{}
+  unicastData (0), unicastDataBytes (0), broadcastData (0), broadcastDataBytes (0)
+{
+}
 
 void
 MeshPointDevice::Report (std::ostream & os) const
 {
   os << "<Statistics \n"
-      "txUnicastData=\"" << m_txStats.unicastData  << "\"\n"
-      "txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"\n"
-      "txBroadcastData=\"" << m_txStats.broadcastData  << "\"\n"
-      "txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"\n"
-      "rxUnicastData=\"" << m_rxStats.unicastData  << "\"\n"
-      "rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"\n"
-      "rxBroadcastData=\"" << m_rxStats.broadcastData  << "\"\n"
-      "rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"\n"
-      "fwdUnicastData=\"" << m_fwdStats.unicastData  << "\"\n"
-      "fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"\n"
-      "fwdBroadcastData=\"" << m_fwdStats.broadcastData  << "\"\n"
-      "fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"\n"
-      "/>\n";
+    "txUnicastData=\"" << m_txStats.unicastData << "\"\n"
+    "txUnicastDataBytes=\"" << m_txStats.unicastDataBytes << "\"\n"
+    "txBroadcastData=\"" << m_txStats.broadcastData << "\"\n"
+    "txBroadcastDataBytes=\"" << m_txStats.broadcastDataBytes << "\"\n"
+    "rxUnicastData=\"" << m_rxStats.unicastData << "\"\n"
+    "rxUnicastDataBytes=\"" << m_rxStats.unicastDataBytes << "\"\n"
+    "rxBroadcastData=\"" << m_rxStats.broadcastData << "\"\n"
+    "rxBroadcastDataBytes=\"" << m_rxStats.broadcastDataBytes << "\"\n"
+    "fwdUnicastData=\"" << m_fwdStats.unicastData << "\"\n"
+    "fwdUnicastDataBytes=\"" << m_fwdStats.unicastDataBytes << "\"\n"
+    "fwdBroadcastData=\"" << m_fwdStats.broadcastData << "\"\n"
+    "fwdBroadcastDataBytes=\"" << m_fwdStats.broadcastDataBytes << "\"\n"
+    "/>\n";
 }
 
 void
--- a/src/devices/mesh/mesh-wifi-beacon.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-beacon.cc	Wed Jul 22 13:31:31 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,68 +14,68 @@
  * 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: Pavel Boyko <boyko@iitp.ru>
  */
 
 #include "ns3/mesh-wifi-beacon.h"
 #include <algorithm>
 
-namespace ns3 {
-  
+namespace ns3
+{
+
 MeshWifiBeacon::MeshWifiBeacon (Ssid ssid, SupportedRates rates, uint64_t us)
 {
   m_header.SetSsid (ssid);
   m_header.SetSupportedRates (rates);
   m_header.SetBeaconIntervalUs (us);
 }
-
-void MeshWifiBeacon::AddInformationElement (Ptr<WifiInformationElement> ie)
+void
+MeshWifiBeacon::AddInformationElement (Ptr<WifiInformationElement> ie)
 {
   m_elements.push_back (ie);
 }
-
-namespace {
+namespace
+{
 /// aux sorter for Ptr<WifiInformationElement>
 struct PIEComparator
 {
-  bool operator () (Ptr<WifiInformationElement> a, Ptr<WifiInformationElement> b) const
+  bool
+  operator () (Ptr<WifiInformationElement> a, Ptr<WifiInformationElement> b) const
   {
-    return ((*PeekPointer (a)) < (*PeekPointer(b)));
+    return ((*PeekPointer (a)) < (*PeekPointer (b)));
   }
 };
 }
 
-Ptr<Packet> MeshWifiBeacon::CreatePacket ()
+Ptr<Packet>
+MeshWifiBeacon::CreatePacket ()
 {
   Ptr<Packet> packet = Create<Packet> ();
-  
-  std::sort (m_elements.begin(), m_elements.end(), PIEComparator());
-  
-  std::vector< Ptr<WifiInformationElement> >::const_reverse_iterator i;
-  for (i = m_elements.rbegin(); i != m_elements.rend(); ++i)
-  {
-    packet->AddHeader (**i);
-  }
-  
-  packet->AddHeader (BeaconHeader());
-  
+
+  std::sort (m_elements.begin (), m_elements.end (), PIEComparator ());
+
+  std::vector<Ptr<WifiInformationElement> >::const_reverse_iterator i;
+  for (i = m_elements.rbegin (); i != m_elements.rend (); ++i)
+    {
+      packet->AddHeader (**i);
+    }
+  packet->AddHeader (BeaconHeader ());
   return packet;
 }
-
-WifiMacHeader MeshWifiBeacon::CreateHeader (Mac48Address address, Mac48Address mpAddress)
+WifiMacHeader
+MeshWifiBeacon::CreateHeader (Mac48Address address, Mac48Address mpAddress)
 {
   WifiMacHeader hdr;
-    
+
   hdr.SetBeacon ();
   hdr.SetAddr1 (Mac48Address::GetBroadcast ());
   hdr.SetAddr2 (address);
   hdr.SetAddr3 (mpAddress);
   hdr.SetDsNotFrom ();
   hdr.SetDsNotTo ();
-  
+
   return hdr;
 }
+} // namespace ns3
 
-} // namespace 
-
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Wed Jul 22 13:31:31 2009 +0400
@@ -33,40 +33,43 @@
 #include "ns3/pointer.h"
 #include "ns3/qos-tag.h"
 
-
 NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
 
-namespace ns3 {
+namespace ns3
+{
 
-NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
+NS_OBJECT_ENSURE_REGISTERED ( MeshWifiInterfaceMac);
 
 TypeId
 MeshWifiInterfaceMac::GetTypeId ()
 {
   static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
-    .SetParent<WifiMac> ()
-    .AddConstructor<MeshWifiInterfaceMac> ()
-    .AddAttribute ("BeaconInterval", "Beacon Interval",
-        TimeValue (Seconds (0.5)),
-        MakeTimeAccessor (&MeshWifiInterfaceMac::m_beaconInterval),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("RandomStart", "Window when beacon generating starts (uniform random) in seconds",
-        TimeValue (Seconds (0.5)),
-        MakeTimeAccessor (&MeshWifiInterfaceMac::m_randomStart),
-        MakeTimeChecker ()
-        )
-    .AddAttribute ("BeaconGeneration", "Enable/Disable Beaconing.",
-        BooleanValue (true),
-        MakeBooleanAccessor (
-          &MeshWifiInterfaceMac::SetBeaconGeneration,
-          &MeshWifiInterfaceMac::GetBeaconGeneration
-          ),
-        MakeBooleanChecker ()
-        );
+  .SetParent<WifiMac> ()
+  .AddConstructor<MeshWifiInterfaceMac> ()
+  .AddAttribute ( "BeaconInterval",
+                  "Beacon Interval",
+                  TimeValue (Seconds (0.5)),
+
+                  MakeTimeAccessor (
+                      &MeshWifiInterfaceMac::m_beaconInterval),
+                  MakeTimeChecker ()
+                  )
+  .AddAttribute ( "RandomStart",
+                  "Window when beacon generating starts (uniform random) in seconds",
+                  TimeValue (Seconds (0.5)),
+                  MakeTimeAccessor (
+                      &MeshWifiInterfaceMac::m_randomStart),
+                  MakeTimeChecker ()
+                  )
+  .AddAttribute ( "BeaconGeneration",
+                  "Enable/Disable Beaconing.",
+                  BooleanValue (true),
+                  MakeBooleanAccessor (
+                      &MeshWifiInterfaceMac::SetBeaconGeneration, &MeshWifiInterfaceMac::GetBeaconGeneration),
+                  MakeBooleanChecker ()
+                  );
   return tid;
 }
-
 MeshWifiInterfaceMac::MeshWifiInterfaceMac ()
 {
   NS_LOG_FUNCTION (this);
@@ -87,12 +90,10 @@
   m_beaconDca->SetAifsn (1);
   m_beaconDca->SetManager (m_dcfManager);
 }
-
 MeshWifiInterfaceMac::~MeshWifiInterfaceMac ()
 {
   NS_LOG_FUNCTION (this);
 }
-
 //-----------------------------------------------------------------------------
 // WifiMac inherited
 //-----------------------------------------------------------------------------
@@ -104,7 +105,6 @@
   m_low->SetSlotTime (slotTime);
   m_slot = slotTime;
 }
-
 void
 MeshWifiInterfaceMac::SetSifs (Time sifs)
 {
@@ -118,13 +118,11 @@
 {
   m_low->SetAckTimeout (ackTimeout);
 }
-
 void
 MeshWifiInterfaceMac::SetCtsTimeout (Time ctsTimeout)
 {
   m_low->SetCtsTimeout (ctsTimeout);
 }
-
 void
 MeshWifiInterfaceMac::SetPifs (Time pifs)
 {
@@ -138,43 +136,36 @@
   m_dcfManager->SetEifsNoDifs (eifsNoDifs);
   m_eifsNoDifs = eifsNoDifs;
 }
-
 Time
 MeshWifiInterfaceMac::GetSlot () const
 {
   return m_slot;
 }
-
 Time
 MeshWifiInterfaceMac::GetSifs () const
 {
   return m_sifs;
 }
-
 Time
 MeshWifiInterfaceMac::GetEifsNoDifs () const
 {
   return m_eifsNoDifs;
 }
-
 Time
 MeshWifiInterfaceMac::GetAckTimeout () const
 {
   return m_low->GetAckTimeout ();
 }
-
 Time
 MeshWifiInterfaceMac::GetCtsTimeout () const
 {
   return m_low->GetCtsTimeout ();
 }
-
 Time
 MeshWifiInterfaceMac::GetPifs () const
 {
   return m_low->GetPifs ();
 }
-
 void
 MeshWifiInterfaceMac::SetWifiPhy (Ptr<WifiPhy> phy)
 {
@@ -183,47 +174,42 @@
   m_dcfManager->SetupPhyListener (phy);
   m_low->SetPhy (phy);
 }
-
 void
 MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
 {
   NS_LOG_FUNCTION (this << stationManager);
   m_stationManager = stationManager;
-  for (Queues::const_iterator i = m_queues.begin (); i != m_queues.end (); i ++)
-  {
-    i->second->SetWifiRemoteStationManager (stationManager);
-  }
+  for (Queues::const_iterator i = m_queues.begin (); i != m_queues.end (); i++)
+    {
+      i->second->SetWifiRemoteStationManager (stationManager);
+    }
   m_beaconDca->SetWifiRemoteStationManager (stationManager);
   m_low->SetWifiRemoteStationManager (stationManager);
 }
-
 void
 MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from)
 {
   NS_LOG_FUNCTION (this << packet << to << from);
   ForwardDown (packet, from, to);
 }
-
 void
 MeshWifiInterfaceMac::Enqueue (Ptr<const Packet> packet, Mac48Address to)
 {
   NS_LOG_FUNCTION (this << packet << to);
   ForwardDown (packet, m_low->GetAddress (), to);
 }
-
 bool
 MeshWifiInterfaceMac::SupportsSendFrom () const
 {
   return true;
 }
-
 void
-MeshWifiInterfaceMac::SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback)
+MeshWifiInterfaceMac::SetForwardUpCallback (
+    Callback<void, Ptr<Packet> , Mac48Address, Mac48Address> upCallback)
 {
   NS_LOG_FUNCTION (this);
   m_upCallback = upCallback;
 }
-
 void
 MeshWifiInterfaceMac::SetLinkUpCallback (Callback<void> linkUp)
 {
@@ -233,13 +219,11 @@
       linkUp ();
     }
 }
-
 void
 MeshWifiInterfaceMac::SetLinkDownCallback (Callback<void> linkDown)
 {
   NS_LOG_FUNCTION (this);
 }
-
 Mac48Address
 MeshWifiInterfaceMac::GetAddress () const
 {
@@ -250,13 +234,11 @@
 {
   return m_address;
 }
-
 Ssid
 MeshWifiInterfaceMac::GetSsid () const
 {
   return m_meshId;
 }
-
 void
 MeshWifiInterfaceMac::SetAddress (Mac48Address address)
 {
@@ -264,14 +246,12 @@
   m_low->SetAddress (address);
   m_address = address;
 }
-
 void
 MeshWifiInterfaceMac::SetSsid (Ssid ssid)
 {
   NS_LOG_FUNCTION (ssid);
   m_meshId = ssid;
 }
-
 void
 MeshWifiInterfaceMac::DoDispose ()
 {
@@ -289,23 +269,22 @@
 
   WifiMac::DoDispose ();
 }
-
 //-----------------------------------------------------------------------------
 // Plugins
 //-----------------------------------------------------------------------------
 void
-MeshWifiInterfaceMac::InstallPlugin ( Ptr<MeshWifiInterfaceMacPlugin> plugin)
+MeshWifiInterfaceMac::InstallPlugin (Ptr<MeshWifiInterfaceMacPlugin> plugin)
 {
   NS_LOG_FUNCTION (this);
 
   plugin->SetParent (this);
   m_plugins.push_back (plugin);
 }
-
 //-----------------------------------------------------------------------------
 // Switch channels
 //-----------------------------------------------------------------------------
-uint16_t MeshWifiInterfaceMac::GetFrequencyChannel () const
+uint16_t
+MeshWifiInterfaceMac::GetFrequencyChannel () const
 {
   NS_LOG_FUNCTION (this);
   NS_ASSERT (m_phy != 0); // need PHY to set/get channel
@@ -320,8 +299,8 @@
       return 0;
     }
 }
-
-void MeshWifiInterfaceMac::SwitchFrequencyChannel (uint16_t new_id)
+void
+MeshWifiInterfaceMac::SwitchFrequencyChannel (uint16_t new_id)
 {
   NS_LOG_FUNCTION (this);
   NS_ASSERT (m_phy != 0); // need PHY to set/get channel
@@ -341,7 +320,6 @@
   // Don't know NAV on new channel
   m_dcfManager->NotifyNavResetNow (Seconds (0));
 }
-
 //-----------------------------------------------------------------------------
 // Forward frame up/down
 //-----------------------------------------------------------------------------
@@ -369,26 +347,21 @@
   hdr.SetQosNoEosp ();
   hdr.SetQosNoAmsdu ();
   hdr.SetQosTxopLimit (0);
-
   // Address 1 is unknwon here. Routing plugin is responsible to correctly set it.
   hdr.SetAddr1 (Mac48Address ());
-
   // Filter packet through all installed plugins
-  for (PluginList::const_iterator i = m_plugins.end()-1; i != m_plugins.begin()-1; i--)
+  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
     {
-      bool drop = ! ((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
+      bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
       if (drop)
         {
           return; // plugin drops frame
         }
     }
-
   // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
-  NS_ASSERT (hdr.GetAddr1() != Mac48Address() );
-
+  NS_ASSERT (hdr.GetAddr1 () != Mac48Address ());
   // Queue frame
   WifiRemoteStation *destination = m_stationManager->Lookup (to);
-
   if (destination->IsBrandNew ())
     {
       // in adhoc mode, we assume that every destination
@@ -407,35 +380,33 @@
     {
       ac = QosUtilsMapTidToAc (tag.Get ());
     }
-  m_stats.sentFrames ++;
+  m_stats.sentFrames++;
   m_stats.sentBytes += packet->GetSize ();
-  NS_ASSERT(m_queues.find(ac) != m_queues.end ());
+  NS_ASSERT (m_queues.find (ac) != m_queues.end ());
   m_queues[ac]->Queue (packet, hdr);
 }
-
 void
 MeshWifiInterfaceMac::SendManagementFrame (Ptr<Packet> packet, const WifiMacHeader& hdr)
 {
   //Filter management frames:
   WifiMacHeader header = hdr;
-  for (PluginList::const_iterator i = m_plugins.end()-1; i != m_plugins.begin()-1; i--)
+  for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
     {
-      bool drop = ! ((*i)->UpdateOutcomingFrame(packet, header, Mac48Address (), Mac48Address ()));
+      bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ()));
       if (drop)
         {
           return; // plugin drops frame
         }
     }
-  m_stats.sentFrames ++;
+  m_stats.sentFrames++;
   m_stats.sentBytes += packet->GetSize ();
   Queues::iterator i = m_queues.find (AC_VO);
   if (i == m_queues.end ())
-  {
-    NS_FATAL_ERROR("Voice queue is not set up!");
-  }
+    {
+      NS_FATAL_ERROR ("Voice queue is not set up!");
+    }
   m_queues[AC_VO]->Queue (packet, header);
 }
-
 SupportedRates
 MeshWifiInterfaceMac::GetSupportedRates () const
 {
@@ -456,42 +427,38 @@
   return rates;
 }
 bool
-MeshWifiInterfaceMac::CheckSupportedRates(SupportedRates rates) const
+MeshWifiInterfaceMac::CheckSupportedRates (SupportedRates rates) const
 {
   for (uint32_t i = 0; i < m_stationManager->GetNBasicModes (); i++)
-  {
-    WifiMode mode = m_stationManager->GetBasicMode (i);
-    if (!rates.IsSupportedRate (mode.GetDataRate ()))
-      {
-        return false;
-      }
-  }
+    {
+      WifiMode mode = m_stationManager->GetBasicMode (i);
+      if (!rates.IsSupportedRate (mode.GetDataRate ()))
+        {
+          return false;
+        }
+    }
   return true;
 }
-
 //-----------------------------------------------------------------------------
 // Beacons
 //-----------------------------------------------------------------------------
-void 
+void
 MeshWifiInterfaceMac::SetRandomStartDelay (Time interval)
 {
   NS_LOG_FUNCTION (this << interval);
   m_randomStart = interval;
 }
-
 void
 MeshWifiInterfaceMac::SetBeaconInterval (Time interval)
 {
   NS_LOG_FUNCTION (this << interval);
   m_beaconInterval = interval;
 }
-
 Time
 MeshWifiInterfaceMac::GetBeaconInterval () const
 {
   return m_beaconInterval;
 }
-
 void
 MeshWifiInterfaceMac::SetBeaconGeneration (bool enable)
 {
@@ -499,11 +466,11 @@
   if (enable)
     {
       // Now start sending beacons after some random delay (to avoid collisions)
-      UniformVariable coefficient (0.0, m_randomStart.GetSeconds());
-      Time randomStart = Seconds (coefficient.GetValue());
+      UniformVariable coefficient (0.0, m_randomStart.GetSeconds ());
+      Time randomStart = Seconds (coefficient.GetValue ());
 
       m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this);
-      m_tbtt = Simulator::Now() + randomStart;
+      m_tbtt = Simulator::Now () + randomStart;
     }
   else
     {
@@ -511,115 +478,108 @@
       m_beaconSendEvent.Cancel ();
     }
 }
-
 bool
 MeshWifiInterfaceMac::GetBeaconGeneration () const
 {
   return m_beaconSendEvent.IsRunning ();
 }
-
 Time
 MeshWifiInterfaceMac::GetTbtt () const
 {
   return m_tbtt;
 }
-
-void MeshWifiInterfaceMac::ShiftTbtt (Time shift)
+void
+MeshWifiInterfaceMac::ShiftTbtt (Time shift)
 {
   // User of ShiftTbtt () must take care don't shift it to the past
-  NS_ASSERT (GetTbtt() + shift > Simulator::Now());
+  NS_ASSERT (GetTbtt () + shift > Simulator::Now ());
 
   m_tbtt += shift;
   // Shift scheduled event
   Simulator::Cancel (m_beaconSendEvent);
-  m_beaconSendEvent = Simulator::Schedule (GetTbtt () - Simulator::Now(), &MeshWifiInterfaceMac::SendBeacon, this);
+  m_beaconSendEvent = Simulator::Schedule (GetTbtt () - Simulator::Now (), &MeshWifiInterfaceMac::SendBeacon,
+      this);
 }
-
 void
 MeshWifiInterfaceMac::ScheduleNextBeacon ()
 {
   m_tbtt += GetBeaconInterval ();
-  m_beaconSendEvent = Simulator::Schedule (GetBeaconInterval(), &MeshWifiInterfaceMac::SendBeacon, this);
+  m_beaconSendEvent = Simulator::Schedule (GetBeaconInterval (), &MeshWifiInterfaceMac::SendBeacon, this);
 }
-
 void
 MeshWifiInterfaceMac::SendBeacon ()
 {
   NS_LOG_FUNCTION (this);
-  NS_LOG_DEBUG (GetAddress() <<" is sending beacon");
+  NS_LOG_DEBUG (GetAddress () << " is sending beacon");
 
-  NS_ASSERT (! m_beaconSendEvent.IsRunning());
-  NS_ASSERT (Simulator::Now().GetMicroSeconds() == GetTbtt().GetMicroSeconds());     // assert that beacon is just on time
+  NS_ASSERT (!m_beaconSendEvent.IsRunning ());
+  NS_ASSERT (Simulator::Now ().GetMicroSeconds () == GetTbtt ().GetMicroSeconds ()); // assert that beacon is just on time
 
   // Form & send beacon
   MeshWifiBeacon beacon (GetSsid (), GetSupportedRates (), m_beaconInterval.GetMicroSeconds ());
 
   // Ask all plugins to add their specific information elements to beacon
-  for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
+  for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
     {
       (*i)->UpdateBeacon (beacon);
     }
-  m_beaconDca->Queue (beacon.CreatePacket(), beacon.CreateHeader(GetAddress (), GetMeshPointAddress ()));
+  m_beaconDca->Queue (beacon.CreatePacket (), beacon.CreateHeader (GetAddress (), GetMeshPointAddress ()));
 
   ScheduleNextBeacon ();
 }
-
 void
 MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr)
 {
   // Process beacon
-  if ((hdr->GetAddr1() != GetAddress()) && (hdr->GetAddr1() != Mac48Address::GetBroadcast()))
+  if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
     {
       return;
     }
   if (hdr->IsBeacon ())
     {
-      m_stats.recvBeacons ++;
+      m_stats.recvBeacons++;
       MgtBeaconHeader beacon_hdr;
       Mac48Address from = hdr->GetAddr2 ();
 
       packet->PeekHeader (beacon_hdr);
 
-      NS_LOG_DEBUG ("Beacon received from "<<hdr->GetAddr2()<<
-                   " I am "<<GetAddress ()<<
-                   " at "<<Simulator::Now ().GetMicroSeconds ()<<
-                   " microseconds");
+      NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
+          << Simulator::Now ().GetMicroSeconds () << " microseconds");
 
       // update supported rates
-      if (beacon_hdr.GetSsid ().IsEqual (GetSsid()))
+      if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
         {
           SupportedRates rates = beacon_hdr.GetSupportedRates ();
           WifiRemoteStation * peerSta = m_stationManager->Lookup (hdr->GetAddr2 ());
 
           for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
-          {
-            WifiMode mode = m_phy->GetMode (i);
-            if (rates.IsSupportedRate (mode.GetDataRate ()))
-              {
-                peerSta->AddSupportedMode (mode);
-                if (rates.IsBasicRate (mode.GetDataRate ()))
-                  {
-                    m_stationManager->AddBasicMode (mode);
-                  }
-              }
-          }
+            {
+              WifiMode mode = m_phy->GetMode (i);
+              if (rates.IsSupportedRate (mode.GetDataRate ()))
+                {
+                  peerSta->AddSupportedMode (mode);
+                  if (rates.IsBasicRate (mode.GetDataRate ()))
+                    {
+                      m_stationManager->AddBasicMode (mode);
+                    }
+                }
+            }
         }
     }
   else
-  {
-    m_stats.recvBytes += packet->GetSize ();
-    m_stats.recvFrames ++;
-  }
+    {
+      m_stats.recvBytes += packet->GetSize ();
+      m_stats.recvFrames++;
+    }
   // Filter frame through all installed plugins
-  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end(); ++i)
+  for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
     {
-      bool drop = ! ((*i)->Receive(packet, *hdr));
+      bool drop = !((*i)->Receive (packet, *hdr));
       if (drop)
         {
           return; // plugin drops frame
         }
     }
-
   // Check if QoS tag exists and add it:
   if (hdr->IsQosData ())
     {
@@ -628,58 +588,50 @@
   // Forward data up
   if (hdr->IsData ())
     {
-      ForwardUp (packet, hdr->GetAddr4(), hdr->GetAddr3());
+      ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
     }
 }
-
 uint32_t
 MeshWifiInterfaceMac::GetLinkMetric (Mac48Address peerAddress)
 {
   uint32_t metric = 1;
   if (!m_linkMetricCallback.IsNull ())
     {
-      metric = m_linkMetricCallback(peerAddress, this);
+      metric = m_linkMetricCallback (peerAddress, this);
     }
   return metric;
 }
-
 void
 MeshWifiInterfaceMac::SetLinkMetricCallback (Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > cb)
 {
   m_linkMetricCallback = cb;
 }
-
 Ptr<WifiRemoteStationManager>
-MeshWifiInterfaceMac::GetStationManager()
+MeshWifiInterfaceMac::GetStationManager ()
 {
   return m_stationManager;
 }
-
 void
 MeshWifiInterfaceMac::SetMeshPointAddress (Mac48Address a)
 {
   m_mpAddress = a;
 }
-
-Mac48Address 
+Mac48Address
 MeshWifiInterfaceMac::GetMeshPointAddress () const
 {
   return m_mpAddress;
 }
 //Statistics:
 MeshWifiInterfaceMac::Statistics::Statistics () :
-  recvBeacons (0),
-  sentFrames (0),
-  sentBytes (0),
-  recvFrames (0),
-  recvBytes (0)
-{}
+  recvBeacons (0), sentFrames (0), sentBytes (0), recvFrames (0), recvBytes (0)
+{
+}
 void
 MeshWifiInterfaceMac::Statistics::Print (std::ostream & os) const
 {
   os << "<Statistics "
-    // TODO txBeacons
-    "rxBeacons=\"" << recvBeacons << "\" "
+  // TODO txBeacons
+        "rxBeacons=\"" << recvBeacons << "\" "
     "txFrames=\"" << sentFrames << "\" "
     "txBytes=\"" << sentBytes << "\" "
     "rxFrames=\"" << recvFrames << "\" "
@@ -689,7 +641,7 @@
 MeshWifiInterfaceMac::Report (std::ostream & os) const
 {
   os << "<Interface "
-    "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds() << "\" "
+    "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
     "Channel=\"" << GetFrequencyChannel () << "\" "
     "Address = \"" << GetAddress () << "\">\n";
   m_stats.Print (os);
@@ -703,13 +655,13 @@
 void
 MeshWifiInterfaceMac::SetQueue (Ptr<DcaTxop> queue, AccessClass ac)
 {
-  Queues::iterator i = m_queues.find(ac);
+  Queues::iterator i = m_queues.find (ac);
   if (i != m_queues.end ())
-  {
-    NS_LOG_WARN("Queue is already set!");
-    return;
-  }
-  m_queues.insert (std::make_pair(ac, queue));
+    {
+      NS_LOG_WARN ("Queue is already set!");
+      return;
+    }
+  m_queues.insert (std::make_pair (ac, queue));
   m_queues[ac]->SetLow (m_low);
   m_queues[ac]->SetManager (m_dcfManager);
 }
@@ -717,11 +669,11 @@
 MeshWifiInterfaceMac::GetQueue (AccessClass ac)
 {
   Queues::iterator i = m_queues.find (ac);
-  if(i != m_queues.end ())
-  {
-    NS_LOG_WARN("Queue is not found! Check access class!");
-    return 0;
-  }
+  if (i != m_queues.end ())
+    {
+      NS_LOG_WARN ("Queue is not found! Check access class!");
+      return 0;
+    }
   return i->second;
 }
 } // namespace ns3
--- a/src/devices/mesh/wifi-information-element.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/devices/mesh/wifi-information-element.cc	Wed Jul 22 13:31:31 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: Pavel Boyko <boyko@iitp.ru>
  */
 
@@ -22,13 +22,14 @@
 #include "ns3/packet.h"
 #include "ns3/log.h"
 
-namespace ns3 {
+namespace ns3
+{
 
 TypeId
 WifiInformationElement::GetTypeId ()
 {
   static TypeId tid = TypeId ("ns3::WifiInformationElement")
-                      .SetParent<Header> ();
+    .SetParent<Header> ();
   return tid;
 }
 
@@ -37,63 +38,70 @@
 {
   return GetTypeId ();
 }
-uint32_t WifiInformationElement::GetSerializedSize () const
+uint32_t
+WifiInformationElement::GetSerializedSize () const
 {
   return (GetInformationSize () + 2);
 }
 
-void WifiInformationElement::Serialize (Buffer::Iterator i) const
+void
+WifiInformationElement::Serialize (Buffer::Iterator i) const
 {
   i.WriteU8 (ElementId ());
   i.WriteU8 (GetInformationSize ());
   SerializeInformation (i);
 }
 
-uint32_t WifiInformationElement::Deserialize (Buffer::Iterator i)
+uint32_t
+WifiInformationElement::Deserialize (Buffer::Iterator i)
 {
-  if(i.ReadU8 () != ElementId())
-    return 0;
+  if (i.ReadU8 () != ElementId ())
+    {
+      return 0;
+    }
   uint8_t length = i.ReadU8 ();
-  
   return (DeserializeInformation (i, length) + 2);
 }
 
-void WifiInformationElement::Print (std::ostream &os) const
+void
+WifiInformationElement::Print (std::ostream &os) const
 {
   os << "\n<information_element id=" << ElementId () << ">\n";
   PrintInformation (os);
   os << "</information_element>\n";
 }
 
-bool WifiInformationElement::FindFirst(Ptr<Packet> packet)
+bool
+WifiInformationElement::FindFirst (Ptr<Packet> packet)
 {
-  const uint8_t * data = packet->PeekData();
+  const uint8_t * data = packet->PeekData ();
   uint32_t position = 0;
-  while(position < packet->GetSize ())
-  {
-    if(data[position] == ElementId())
+  while (position < packet->GetSize ())
     {
-      Ptr<Packet> myIe = packet->CreateFragment(position, data[position+1]+2);
-      NS_ASSERT(myIe->GetSize() == (uint32_t)(data[position+1]+2));
-      myIe->RemoveHeader(*this);
-      return true;
+      if (data[position] == ElementId ())
+        {
+          Ptr<Packet> myIe = packet->CreateFragment (position, data[position + 1] + 2);
+          NS_ASSERT (myIe->GetSize () == (uint32_t) (data[position + 1] + 2));
+          myIe->RemoveHeader (*this);
+          return true;
+        }
+      else
+        {
+          if (data[position] > ElementId ())
+            {
+              return false;
+            }
+          position += data[position + 1] + 2;
+        }
     }
-    else
-    {
-      if(data[position] > ElementId())
-        return false;
-      position +=data[position+1]+2;
-    }
-  }
   return false;
 }
 
-bool operator< (WifiInformationElement const & a, WifiInformationElement const & b)
+bool
+operator< (WifiInformationElement const & a, WifiInformationElement const & b)
 {
-  return (a.ElementId () < b.ElementId());
+  return (a.ElementId () < b.ElementId ());
 }
 
-
 }
 
-
--- a/src/helper/mesh-helper.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/helper/mesh-helper.cc	Wed Jul 22 13:31:31 2009 +0400
@@ -24,60 +24,65 @@
 #include "ns3/wifi-net-device.h"
 #include "ns3/log.h"
 NS_LOG_COMPONENT_DEFINE ("MeshHelper");
-namespace ns3 {
-MeshHelper::MeshHelper () : 
-    m_spreadInterfaceChannels (false),
-    m_stack (0)
+namespace ns3
+{
+MeshHelper::MeshHelper () :
+  m_spreadInterfaceChannels (false), m_stack (0)
 {
 }
-void 
+void
 MeshHelper::SetSpreadInterfaceChannels (bool s)
 {
   m_spreadInterfaceChannels = s;
 }
-void 
+void
 MeshHelper::SetStackInstaller (std::string type)
 {
   NS_LOG_FUNCTION (this << type);
   m_stackFactory.SetTypeId (type);
   m_stack = m_stackFactory.Create<MeshStack> ();
   if (m_stack == 0)
-    NS_FATAL_ERROR ("Stack has not been created: "<<type);
+    {
+      NS_FATAL_ERROR ("Stack has not been created: " << type);
+    }
 }
 
 NetDeviceContainer
-MeshHelper::Install (const WifiPhyHelper &phyHelper, const MeshInterfaceHelper &interfaceHelper, NodeContainer c, uint32_t nInterfaces) const
+MeshHelper::Install (const WifiPhyHelper &phyHelper, const MeshInterfaceHelper &interfaceHelper,
+    NodeContainer c, uint32_t nInterfaces) const
 {
   NetDeviceContainer devices;
   NS_ASSERT (m_stack != 0);
   uint16_t node_counter = 0;
   for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
-  {
-    Ptr<Node> node = *i;
-    
-    // Create a mesh point device
-    Ptr<MeshPointDevice> mp = CreateObject<MeshPointDevice> ();
-    node->AddDevice (mp);
-    
-    // Create wifi interfaces (single interface by default)
-    for (uint32_t i = 0; i < nInterfaces; ++i)
-      {
-        uint32_t channel = i * 5;
-        Ptr<WifiNetDevice> iface = interfaceHelper.CreateInterface (phyHelper,node, (m_spreadInterfaceChannels ? channel : 0));
-        mp->AddInterface (iface);
-      }
-    if(!m_stack->InstallStack (mp))
     {
-      NS_FATAL_ERROR ("Stack is not installed!");
+      Ptr<Node> node = *i;
+
+      // Create a mesh point device
+      Ptr<MeshPointDevice> mp = CreateObject<MeshPointDevice> ();
+      node->AddDevice (mp);
+
+      // Create wifi interfaces (single interface by default)
+      for (uint32_t i = 0; i < nInterfaces; ++i)
+        {
+          uint32_t channel = i * 5;
+          Ptr<WifiNetDevice> iface = interfaceHelper.CreateInterface (phyHelper, node,
+              (m_spreadInterfaceChannels ? channel : 0));
+          mp->AddInterface (iface);
+        }
+      if (!m_stack->InstallStack (mp))
+        {
+          NS_FATAL_ERROR ("Stack is not installed!");
+        }
+      devices.Add (mp);
+      node_counter++;
     }
-    devices.Add (mp);
-    node_counter ++;
-  }
   return devices;
 }
 
 NetDeviceContainer
-MeshHelper::Install (const WifiPhyHelper &phy, const MeshInterfaceHelper &interfaceHelper, Ptr<Node> node, uint32_t nInterfaces) const
+MeshHelper::Install (const WifiPhyHelper &phy, const MeshInterfaceHelper &interfaceHelper, Ptr<Node> node,
+    uint32_t nInterfaces) const
 {
   return Install (phy, interfaceHelper, NodeContainer (node), nInterfaces);
 }
@@ -85,10 +90,11 @@
 MeshHelper::Report (const ns3::Ptr<ns3::NetDevice>& device, std::ostream& os)
 {
   NS_ASSERT (m_stack != 0);
-  Ptr <MeshPointDevice> mp = device->GetObject<MeshPointDevice> ();
+  Ptr<MeshPointDevice> mp = device->GetObject<MeshPointDevice> ();
   NS_ASSERT (mp != 0);
   std::vector<Ptr<NetDevice> > ifaces = mp->GetInterfaces ();
-  os << "<MeshPointDevice time=\"" << Simulator::Now().GetSeconds() << "\" address=\"" << Mac48Address::ConvertFrom(mp->GetAddress ()) << "\">\n";
+  os << "<MeshPointDevice time=\"" << Simulator::Now ().GetSeconds () << "\" address=\""
+      << Mac48Address::ConvertFrom (mp->GetAddress ()) << "\">\n";
   m_stack->Report (mp, os);
   os << "</MeshPointDevice>\n";
 }
@@ -96,7 +102,7 @@
 MeshHelper::ResetStats (const ns3::Ptr<ns3::NetDevice>& device)
 {
   NS_ASSERT (m_stack != 0);
-  Ptr <MeshPointDevice> mp = device->GetObject<MeshPointDevice> ();
+  Ptr<MeshPointDevice> mp = device->GetObject<MeshPointDevice> ();
   NS_ASSERT (mp != 0);
   m_stack->ResetStats (mp);
 }
--- a/src/helper/mesh-interface-helper.cc	Tue Jul 21 15:49:24 2009 +0400
+++ b/src/helper/mesh-interface-helper.cc	Wed Jul 22 13:31:31 2009 +0400
@@ -24,7 +24,8 @@
 #include "ns3/pointer.h"
 #include "ns3/dca-txop.h"
 #include "ns3/wifi-remote-station-manager.h"
-namespace ns3 {
+namespace ns3
+{
 
 MeshInterfaceHelper::MeshInterfaceHelper ()
 {
@@ -91,7 +92,7 @@
     NS_FATAL_ERROR ("Queue is not set!");
   }
 }
-void 
+void
 MeshInterfaceHelper::SetRemoteStationManager (std::string type,
                                      std::string n0, const AttributeValue &v0,
                                      std::string n1, const AttributeValue &v1,
@@ -117,8 +118,8 @@
 MeshInterfaceHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const
 {
   Ptr<WifiNetDevice> device = CreateObject<WifiNetDevice> ();
-  
-  Ptr<MeshWifiInterfaceMac> mac = DynamicCast <MeshWifiInterfaceMac> (Create ());
+
+  Ptr<MeshWifiInterfaceMac> mac = DynamicCast<MeshWifiInterfaceMac> (Create ());
   NS_ASSERT (mac != 0);
   mac->SetSsid (Ssid ());
   Ptr<WifiRemoteStationManager> manager = m_stationManager.Create<WifiRemoteStationManager> ();
@@ -135,24 +136,23 @@
 MeshInterfaceHelper::Create (void) const
 {
   Ptr<MeshWifiInterfaceMac> mac = m_mac.Create<MeshWifiInterfaceMac> ();
-  for (std::map<AccessClass, ObjectFactory>::const_iterator i = m_queues.begin (); i != m_queues.end (); i ++)
-  {
-    //Ptr<DcaTxop> dca = i->second->Create ();
-    mac->SetQueue(i->second.Create<DcaTxop> (), i->first);
-  }
+  for (std::map<AccessClass, ObjectFactory>::const_iterator i = m_queues.begin (); i != m_queues.end (); i++)
+    {
+      mac->SetQueue (i->second.Create<DcaTxop> (), i->first);
+    }
   return mac;
 }
 void
 MeshInterfaceHelper::Report (const Ptr<WifiNetDevice>& device, std::ostream& os)
 {
-  Ptr<MeshWifiInterfaceMac> mac = device->GetMac()->GetObject<MeshWifiInterfaceMac> ();
+  Ptr<MeshWifiInterfaceMac> mac = device->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
   NS_ASSERT (mac != 0);
-  mac->Report(os);
+  mac->Report (os);
 }
 void
 MeshInterfaceHelper::ResetStats (const Ptr<WifiNetDevice>& device)
 {
-  Ptr<MeshWifiInterfaceMac> mac = device->GetMac()->GetObject<MeshWifiInterfaceMac> ();
+  Ptr<MeshWifiInterfaceMac> mac = device->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
   NS_ASSERT (mac != 0);
   mac->ResetStats ();
 }