Added docs to peer link frame cleass, mesh-wifi-mac-header has been moved to
authorKirill Andreev <andreev@iitp.ru>
Wed, 08 Apr 2009 17:50:52 +0400
changeset 4949 c376fb558264
parent 4948 f47497fde31a
child 4950 1163cfb03b9b
Added docs to peer link frame cleass, mesh-wifi-mac-header has been moved to dot11s namespace
src/devices/mesh/dot11s/hwmp-mac-plugin.cc
src/devices/mesh/dot11s/mesh-wifi-mac-header.cc
src/devices/mesh/dot11s/mesh-wifi-mac-header.h
src/devices/mesh/dot11s/peer-link-frame.h
src/devices/mesh/dot11s/peer-management-plugin.cc
src/devices/mesh/dot11s/wscript
src/devices/mesh/mesh-wifi-interface-mac.cc
src/devices/mesh/mesh-wifi-mac-header.cc
src/devices/mesh/mesh-wifi-mac-header.h
src/devices/mesh/wscript
--- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Wed Apr 08 17:23:41 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Wed Apr 08 17:50:52 2009 +0400
@@ -23,9 +23,8 @@
 #include "ns3/simulator.h"
 #include "ns3/nstime.h"
 #include "ns3/log.h"
-#include "ns3/mesh-wifi-mac-header.h"
-
 #include "hwmp-mac-plugin.h"
+#include "mesh-wifi-mac-header.h"
 #include "hwmp-protocol.h"
 #include "hwmp-tag.h"
 #include "ie-dot11s-preq.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/mesh/dot11s/mesh-wifi-mac-header.cc	Wed Apr 08 17:50:52 2009 +0400
@@ -0,0 +1,338 @@
+/* -*-  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;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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>
+ */
+
+
+#include "ns3/assert.h"
+#include "ns3/address-utils.h"
+#include "mesh-wifi-mac-header.h"
+
+namespace ns3 {
+namespace dot11s {
+/***********************************************************
+ *  Here Mesh Mac Header functionality is defined.
+ ***********************************************************/
+TypeId
+WifiMeshHeader::GetTypeId ()
+{
+  static TypeId tid = TypeId ("ns3::WifiMeshHeader")
+    .SetParent<Header> ()
+    .AddConstructor<WifiMeshHeader> ()
+    ;
+  return tid;
+}
+WifiMeshHeader::WifiMeshHeader ():
+  m_meshFlags (0),
+  m_meshTtl (0),
+  m_meshSeqno (0),
+  m_addr4 (Mac48Address ()),
+  m_addr5 (Mac48Address ()),
+  m_addr6 (Mac48Address ())
+{
+}
+WifiMeshHeader::~WifiMeshHeader ()
+{
+}
+TypeId
+WifiMeshHeader::GetInstanceTypeId () const
+{
+  return GetTypeId ();
+}
+void
+WifiMeshHeader::SetAddr4 (Mac48Address address)
+{
+  m_addr4 = address;
+}
+void
+WifiMeshHeader::SetAddr5 (Mac48Address address)
+{
+  m_addr5 = address;
+}
+void
+WifiMeshHeader::SetAddr6 (Mac48Address address)
+{
+  m_addr6 = address;
+}
+Mac48Address
+WifiMeshHeader::GetAddr4 () const
+{
+  return m_addr4;
+}
+Mac48Address
+WifiMeshHeader::GetAddr5 () const
+{
+  return m_addr5;
+}
+Mac48Address
+WifiMeshHeader::GetAddr6 () const
+{
+  return m_addr6;
+}
+void
+WifiMeshHeader::SetMeshSeqno (uint32_t seqno)
+{
+  m_meshSeqno = seqno;
+}
+uint32_t
+WifiMeshHeader::GetMeshSeqno () const
+{
+  return m_meshSeqno;
+}
+void
+WifiMeshHeader::SetMeshTtl (uint8_t TTL)
+{
+  m_meshTtl = TTL;
+}
+uint8_t
+WifiMeshHeader::GetMeshTtl () const
+{
+  return m_meshTtl;
+}
+void
+WifiMeshHeader::SetAddressExt (uint8_t num_of_addresses)
+{
+  if (num_of_addresses > 3)
+    return;
+  m_meshFlags |= 0xc0 & (num_of_addresses << 6);
+}
+uint8_t
+WifiMeshHeader::GetAddressExt () const
+{
+  return ((0xc0 & m_meshFlags) >> 6);
+}
+uint32_t
+WifiMeshHeader::GetSerializedSize () const
+{
+  return 6 + GetAddressExt () * 6;
+}
+void
+WifiMeshHeader::Serialize (Buffer::Iterator start) const
+{
+  Buffer::Iterator i = start;
+  i.WriteU8 (m_meshFlags);
+  i.WriteU8 (m_meshTtl);
+  i.WriteU32 (m_meshSeqno);
+  uint8_t addresses_to_add = GetAddressExt ();
+  //Writing Address extensions:
+  if (addresses_to_add > 0)
+    WriteTo (i, m_addr4);
+  if (addresses_to_add > 1)
+    WriteTo (i, m_addr5);
+  if (addresses_to_add > 2)
+    WriteTo (i, m_addr6);
+}
+uint32_t
+WifiMeshHeader::Deserialize (Buffer::Iterator start)
+{
+  Buffer::Iterator i = start;
+  uint8_t addresses_to_read = 0;
+  m_meshFlags = i.ReadU8 ();
+  m_meshTtl = i.ReadU8 ();
+  m_meshSeqno = i.ReadU32 ();
+  addresses_to_read = (m_meshFlags & 0xc0) >> 6;
+  if (addresses_to_read > 0)
+    ReadFrom (i, m_addr4);
+  if (addresses_to_read > 1)
+    ReadFrom (i, m_addr5);
+  if (addresses_to_read > 2)
+    ReadFrom (i, m_addr6);
+  return i.GetDistanceFrom (start);
+}
+void
+WifiMeshHeader::Print (std::ostream &os) const
+{
+  os << "flags" << m_meshFlags
+  << "ttl" << m_meshTtl
+  << "seqno" << m_meshSeqno;
+}
+/**********************************************************
+ *   MultihopActionFrame
+ **********************************************************/
+WifiMeshMultihopActionHeader::WifiMeshMultihopActionHeader ()
+{
+}
+WifiMeshMultihopActionHeader::~WifiMeshMultihopActionHeader ()
+{
+}
+void
+WifiMeshMultihopActionHeader::SetAction (
+  WifiMeshMultihopActionHeader::CategoryValue type,
+  WifiMeshMultihopActionHeader::ACTION_VALUE action)
+{
+  switch (type)
+    {
+    case MESH_PEER_LINK_MGT:
+      m_category = 4;
+      switch (action.peerLink)
+        {
+        case PEER_LINK_OPEN:
+          m_actionValue = 0;
+          break;
+        case PEER_LINK_CONFIRM:
+          m_actionValue = 1;
+          break;
+        case PEER_LINK_CLOSE:
+          m_actionValue = 2;
+          break;
+        };
+      break;
+    case MESH_LINK_METRIC:
+      m_category = 5;
+      break;
+    case MESH_PATH_SELECTION:
+      m_category = 6;
+      switch (action.pathSelection)
+        {
+        case PATH_REQUEST:
+          m_actionValue = 0;
+          break;
+        case PATH_REPLY:
+          m_actionValue = 1;
+          break;
+        case PATH_ERROR:
+          m_actionValue = 2;
+          break;
+        case ROOT_ANNOUNCEMENT:
+          m_actionValue = 3;
+          break;
+        };
+      break;
+    case MESH_INTERWORK_ACTION:
+      m_category = 7;
+      break;
+    case MESH_RESOURCE_COORDINATION:
+      m_category = 8;
+      break;
+    };
+}
+WifiMeshMultihopActionHeader::CategoryValue
+WifiMeshMultihopActionHeader::GetCategory ()
+{
+  switch (m_category)
+    {
+    case 4:
+      return MESH_PEER_LINK_MGT;
+    case 5:
+      return MESH_LINK_METRIC;
+    case 6:
+      return MESH_PATH_SELECTION;
+    case 7:
+      return MESH_INTERWORK_ACTION;
+    case 8:
+      return MESH_RESOURCE_COORDINATION;
+    default:
+      NS_ASSERT (false);
+      return MESH_PEER_LINK_MGT;
+    }
+}
+WifiMeshMultihopActionHeader::ACTION_VALUE
+WifiMeshMultihopActionHeader::GetAction ()
+{
+  ACTION_VALUE retval;
+  switch (m_category)
+    {
+    case 4:
+      //MESH_PEER_LINK_MGT;
+      switch (m_actionValue)
+        {
+        case 0:
+          retval.peerLink = PEER_LINK_OPEN;
+          return retval;
+        case 1:
+          retval.peerLink = PEER_LINK_CONFIRM;
+          return retval;
+        case 2:
+          retval.peerLink = PEER_LINK_CLOSE;
+          return retval;
+        default:
+          NS_ASSERT (false);
+          return retval;
+
+        }
+    case 5:
+      //MESH_LINK_METRIC;
+    case 6:
+      //MESH_PATH_SELECTION;
+      switch (m_actionValue)
+        {
+        case 0:
+          retval.pathSelection = PATH_REQUEST;
+          return retval;
+        case 1:
+          retval.pathSelection = PATH_REPLY;
+          return retval;
+        case 2:
+          retval.pathSelection = PATH_ERROR;
+          return retval;
+        case 3:
+          retval.pathSelection = ROOT_ANNOUNCEMENT;
+          return retval;
+        default:
+          NS_ASSERT (false);
+          return retval;
+        }
+
+    case 7:
+      //MESH_INTERWORK_ACTION;
+    case 8:
+      //MESH_RESOURCE_COORDINATION;
+    default:
+      NS_ASSERT (false);
+      return retval;
+    }
+}
+TypeId
+WifiMeshMultihopActionHeader::GetTypeId ()
+{
+  static TypeId tid = TypeId ("ns3::WifiMeshMultihopActionHeader")
+                      .SetParent<Header> ()
+                      .AddConstructor<WifiMeshMultihopActionHeader> ()
+                      ;
+  return tid;
+}
+TypeId
+WifiMeshMultihopActionHeader::GetInstanceTypeId () const
+{
+  return GetTypeId ();
+}
+void
+WifiMeshMultihopActionHeader::Print (std::ostream &os) const
+{
+}
+uint32_t
+WifiMeshMultihopActionHeader::GetSerializedSize () const
+{
+  return 2;
+}
+void
+WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
+{
+  start.WriteU8 (m_category);
+  start.WriteU8 (m_actionValue);
+}
+uint32_t
+WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
+{
+  Buffer::Iterator i = start;
+  m_category = i.ReadU8 ();
+  m_actionValue = i.ReadU8 ();
+  return i.GetDistanceFrom (start);
+}
+} //namespace dot11s
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/mesh/dot11s/mesh-wifi-mac-header.h	Wed Apr 08 17:50:52 2009 +0400
@@ -0,0 +1,151 @@
+/* -*-  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;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * 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>
+ */
+
+
+#ifndef MESH_WIFI_MAC_HEADER_H
+#define MESH_WIFI_MAC_HEADER_H
+
+#include "ns3/header.h"
+#include "ns3/mac48-address.h"
+
+namespace ns3 {
+namespace dot11s {
+/**
+ * \ingroup dot11s
+ */
+class WifiMeshHeader : public Header //7.1.3.5b
+{
+public:
+  WifiMeshHeader ();
+  ~WifiMeshHeader ();
+  static TypeId GetTypeId ();
+  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   SetMeshSeqno (uint32_t seqno);
+  uint32_t  GetMeshSeqno () const;
+
+  void   SetMeshTtl (uint8_t TTL);
+  uint8_t  GetMeshTtl () 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 uint32_t Deserialize (Buffer::Iterator start);
+private:
+  uint8_t  m_meshFlags;
+  uint8_t  m_meshTtl;
+  uint32_t m_meshSeqno;
+  Mac48Address m_addr4;
+  Mac48Address m_addr5;
+  Mac48Address m_addr6;
+};
+
+/**
+ * \ingroup mesh
+ */
+class WifiMeshMultihopActionHeader : public Header //7.2.3.14
+{
+  //Multichop action frame consists of Mesh header, Action, and
+  //the last information. Mesh header is present within all data
+  //frames and multihop action frames, so Mesh header is a
+  //separate structure. Each MultihopAction frames (frames like
+  //PREQ, PREP and other) start form Category field and Action
+  //value field, so the Multihop Action Frame should containt
+  //three fields: Category, Action Value;
+public:
+  WifiMeshMultihopActionHeader ();
+  ~WifiMeshMultihopActionHeader ();
+  enum CategoryValue //table 7-24 staring from 4
+  {
+    MESH_PEER_LINK_MGT =4,
+    MESH_LINK_METRIC,
+    MESH_PATH_SELECTION,
+    MESH_INTERWORK_ACTION,
+    MESH_RESOURCE_COORDINATION,
+  };
+  enum PeerLinkMgtActionValue
+  {
+    PEER_LINK_OPEN = 0,
+    PEER_LINK_CONFIRM,
+    PEER_LINK_CLOSE,
+  };
+  enum LinkMetricActionValue
+  {
+    LINK_METRIC_REQUEST = 0,
+    LINK_METRIC_REPORT,
+  };
+  enum PathSelectionActionValue
+  {
+    PATH_REQUEST = 0,
+    PATH_REPLY,
+    PATH_ERROR,
+    ROOT_ANNOUNCEMENT,
+  };
+  enum InterworkActionValue
+  {
+    PORTAL_ANNOUNCEMENT = 0,
+  };
+  enum ResourceCoordinationActionValue
+  {
+    CONGESTION_CONTROL_NOTIFICATION = 0,
+    MDA_SETUP_REQUEST,
+    MDA_SETUP_REPLY,
+    MDAOP_ADVERTISMENT_REQUEST,
+    MDAOP_ADVERTISMENTS,
+    MDAOP_SET_TEARDOWN,
+    BEACON_TIMING_REQUEST,
+    BEACON_TIMING_RESPONSE,
+    TBTT_ADJASTMENT_REQUEST,
+    MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
+  };
+  typedef union
+  {
+    enum PeerLinkMgtActionValue  peerLink;
+    enum LinkMetricActionValue  linkMetrtic;
+    enum PathSelectionActionValue  pathSelection;
+    enum InterworkActionValue  interwork;
+    enum ResourceCoordinationActionValue resourceCoordination;
+  } ACTION_VALUE;
+  void   SetAction (enum CategoryValue type,ACTION_VALUE action);
+  enum CategoryValue GetCategory ();
+  ACTION_VALUE  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 uint32_t Deserialize (Buffer::Iterator start);
+private:
+  uint8_t m_category;
+  uint8_t m_actionValue;
+};
+} //namespace dot11s
+} // namespace ns3
+#endif /* MESH_WIFI_MAC_HEADER_H */
--- a/src/devices/mesh/dot11s/peer-link-frame.h	Wed Apr 08 17:23:41 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link-frame.h	Wed Apr 08 17:50:52 2009 +0400
@@ -27,10 +27,22 @@
 namespace ns3 {
 class MeshWifiInterfaceMac;
 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):
+ * - Subtype field
+ * - Association ID field
+ * - Supported rates
+ * - SSID of mesh
+ */
 class PeerLinkFrameStart : public Header
 {
 public:
   PeerLinkFrameStart ();
+  ///\brief fields:
   struct PlinkFrameStartFields
   {
     uint8_t subtype;
--- a/src/devices/mesh/dot11s/peer-management-plugin.cc	Wed Apr 08 17:23:41 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-plugin.cc	Wed Apr 08 17:50:52 2009 +0400
@@ -23,11 +23,10 @@
 #include "peer-management-plugin.h"
 #include "peer-management-protocol.h"
 #include "peer-link-frame.h"
+#include "mesh-wifi-mac-header.h"
 #include "ns3/mesh-wifi-interface-mac.h"
-#include "ns3/mesh-wifi-mac-header.h"
 #include "ns3/simulator.h"
 #include "ns3/wifi-mac-header.h"
-#include "ns3/mesh-wifi-mac-header.h"
 #include "ns3/log.h"
 
 NS_LOG_COMPONENT_DEFINE("PeerManager");
--- a/src/devices/mesh/dot11s/wscript	Wed Apr 08 17:23:41 2009 +0400
+++ b/src/devices/mesh/dot11s/wscript	Wed Apr 08 17:50:52 2009 +0400
@@ -20,6 +20,7 @@
         'hwmp-protocol.cc',
         'airtime-metric.cc',
         'dot11s-helper.cc',
+        'mesh-wifi-mac-header.cc',
         ]
     headers = bld.new_task_gen('ns3header')
     headers.module = 'dot11s'
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Wed Apr 08 17:23:41 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Wed Apr 08 17:50:52 2009 +0400
@@ -27,7 +27,7 @@
 #include "ns3/mac-rx-middle.h"
 #include "ns3/mac-low.h"
 #include "ns3/dca-txop.h"
-#include "ns3/mesh-wifi-mac-header.h"
+//#include "ns3/mesh-wifi-mac-header.h"
 #include "ns3/random-variable.h"
 #include "ns3/simulator.h"
 #include "ns3/yans-wifi-phy.h"
--- a/src/devices/mesh/mesh-wifi-mac-header.cc	Wed Apr 08 17:23:41 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/* -*-  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;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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>
- */
-
-
-#include "ns3/assert.h"
-#include "ns3/address-utils.h"
-#include "ns3/mesh-wifi-mac-header.h"
-
-namespace ns3 {
-
-/***********************************************************
- *  Here Mesh Mac Header functionality is defined.
- ***********************************************************/
-TypeId
-WifiMeshHeader::GetTypeId ()
-{
-  static TypeId tid = TypeId ("ns3::WifiMeshHeader")
-    .SetParent<Header> ()
-    .AddConstructor<WifiMeshHeader> ()
-    ;
-  return tid;
-}
-
-WifiMeshHeader::WifiMeshHeader ():
-  m_meshFlags (0),
-  m_meshTtl (0),
-  m_meshSeqno (0),
-  m_addr4 (Mac48Address ()),
-  m_addr5 (Mac48Address ()),
-  m_addr6 (Mac48Address ())
-{
-}
-
-WifiMeshHeader::~WifiMeshHeader ()
-{
-}
-
-TypeId
-WifiMeshHeader::GetInstanceTypeId () const
-{
-  return GetTypeId ();
-}
-
-void
-WifiMeshHeader::SetAddr4 (Mac48Address address)
-{
-  m_addr4 = address;
-}
-
-void
-WifiMeshHeader::SetAddr5 (Mac48Address address)
-{
-  m_addr5 = address;
-}
-
-void
-WifiMeshHeader::SetAddr6 (Mac48Address address)
-{
-  m_addr6 = address;
-}
-
-Mac48Address
-WifiMeshHeader::GetAddr4 () const
-{
-  return m_addr4;
-}
-
-Mac48Address
-WifiMeshHeader::GetAddr5 () const
-{
-  return m_addr5;
-}
-
-Mac48Address
-WifiMeshHeader::GetAddr6 () const
-{
-  return m_addr6;
-}
-
-void
-WifiMeshHeader::SetMeshSeqno (uint32_t seqno)
-{
-  m_meshSeqno = seqno;
-}
-
-uint32_t
-WifiMeshHeader::GetMeshSeqno () const
-{
-  return m_meshSeqno;
-}
-
-void
-WifiMeshHeader::SetMeshTtl (uint8_t TTL)
-{
-  m_meshTtl = TTL;
-}
-
-uint8_t
-WifiMeshHeader::GetMeshTtl () const
-{
-  return m_meshTtl;
-}
-
-void
-WifiMeshHeader::SetAddressExt (uint8_t num_of_addresses)
-{
-  if (num_of_addresses > 3)
-    return;
-  m_meshFlags |= 0xc0 & (num_of_addresses << 6);
-}
-
-uint8_t
-WifiMeshHeader::GetAddressExt () const
-{
-  return ((0xc0 & m_meshFlags) >> 6);
-}
-
-
-uint32_t
-WifiMeshHeader::GetSerializedSize () const
-{
-  return 6 + GetAddressExt () * 6;
-}
-
-void
-WifiMeshHeader::Serialize (Buffer::Iterator start) const
-{
-  Buffer::Iterator i = start;
-  i.WriteU8 (m_meshFlags);
-  i.WriteU8 (m_meshTtl);
-  i.WriteU32 (m_meshSeqno);
-  uint8_t addresses_to_add = GetAddressExt ();
-  //Writing Address extensions:
-  if (addresses_to_add > 0)
-    WriteTo (i, m_addr4);
-  if (addresses_to_add > 1)
-    WriteTo (i, m_addr5);
-  if (addresses_to_add > 2)
-    WriteTo (i, m_addr6);
-}
-
-uint32_t
-WifiMeshHeader::Deserialize (Buffer::Iterator start)
-{
-  Buffer::Iterator i = start;
-  uint8_t addresses_to_read = 0;
-  m_meshFlags = i.ReadU8 ();
-  m_meshTtl = i.ReadU8 ();
-  m_meshSeqno = i.ReadU32 ();
-  addresses_to_read = (m_meshFlags & 0xc0) >> 6;
-  if (addresses_to_read > 0)
-    ReadFrom (i, m_addr4);
-  if (addresses_to_read > 1)
-    ReadFrom (i, m_addr5);
-  if (addresses_to_read > 2)
-    ReadFrom (i, m_addr6);
-  return i.GetDistanceFrom (start);
-}
-void
-WifiMeshHeader::Print (std::ostream &os) const
-{
-  os << "flags" << m_meshFlags
-  << "ttl" << m_meshTtl
-  << "seqno" << m_meshSeqno;
-}
-/**********************************************************
- *   MultihopActionFrame
- **********************************************************/
-WifiMeshMultihopActionHeader::WifiMeshMultihopActionHeader ()
-{
-}
-
-WifiMeshMultihopActionHeader::~WifiMeshMultihopActionHeader ()
-{
-}
-
-void
-WifiMeshMultihopActionHeader::SetAction (
-  enum WifiMeshMultihopActionHeader::CategoryValue type,
-  WifiMeshMultihopActionHeader::ACTION_VALUE action)
-{
-  switch (type)
-    {
-    case MESH_PEER_LINK_MGT:
-      m_category = 4;
-      switch (action.peerLink)
-        {
-        case PEER_LINK_OPEN:
-          m_actionValue = 0;
-          break;
-        case PEER_LINK_CONFIRM:
-          m_actionValue = 1;
-          break;
-        case PEER_LINK_CLOSE:
-          m_actionValue = 2;
-          break;
-        };
-      break;
-    case MESH_LINK_METRIC:
-      m_category = 5;
-      break;
-    case MESH_PATH_SELECTION:
-      m_category = 6;
-      switch (action.pathSelection)
-        {
-        case PATH_REQUEST:
-          m_actionValue = 0;
-          break;
-        case PATH_REPLY:
-          m_actionValue = 1;
-          break;
-        case PATH_ERROR:
-          m_actionValue = 2;
-          break;
-        case ROOT_ANNOUNCEMENT:
-          m_actionValue = 3;
-          break;
-        };
-      break;
-    case MESH_INTERWORK_ACTION:
-      m_category = 7;
-      break;
-    case MESH_RESOURCE_COORDINATION:
-      m_category = 8;
-      break;
-    };
-}
-
-enum WifiMeshMultihopActionHeader::CategoryValue
-WifiMeshMultihopActionHeader::GetCategory ()
-{
-  switch (m_category)
-    {
-    case 4:
-      return MESH_PEER_LINK_MGT;
-    case 5:
-      return MESH_LINK_METRIC;
-    case 6:
-      return MESH_PATH_SELECTION;
-    case 7:
-      return MESH_INTERWORK_ACTION;
-    case 8:
-      return MESH_RESOURCE_COORDINATION;
-    default:
-      NS_ASSERT (false);
-      return MESH_PEER_LINK_MGT;
-    }
-}
-
-WifiMeshMultihopActionHeader::ACTION_VALUE
-WifiMeshMultihopActionHeader::GetAction ()
-{
-  ACTION_VALUE retval;
-  switch (m_category)
-    {
-    case 4:
-      //MESH_PEER_LINK_MGT;
-      switch (m_actionValue)
-        {
-        case 0:
-          retval.peerLink = PEER_LINK_OPEN;
-          return retval;
-        case 1:
-          retval.peerLink = PEER_LINK_CONFIRM;
-          return retval;
-        case 2:
-          retval.peerLink = PEER_LINK_CLOSE;
-          return retval;
-        default:
-          NS_ASSERT (false);
-          return retval;
-
-        }
-    case 5:
-      //MESH_LINK_METRIC;
-    case 6:
-      //MESH_PATH_SELECTION;
-      switch (m_actionValue)
-        {
-        case 0:
-          retval.pathSelection = PATH_REQUEST;
-          return retval;
-        case 1:
-          retval.pathSelection = PATH_REPLY;
-          return retval;
-        case 2:
-          retval.pathSelection = PATH_ERROR;
-          return retval;
-        case 3:
-          retval.pathSelection = ROOT_ANNOUNCEMENT;
-          return retval;
-        default:
-          NS_ASSERT (false);
-          return retval;
-        }
-
-    case 7:
-      //MESH_INTERWORK_ACTION;
-    case 8:
-      //MESH_RESOURCE_COORDINATION;
-    default:
-      NS_ASSERT (false);
-      return retval;
-    }
-}
-
-TypeId
-WifiMeshMultihopActionHeader::GetTypeId ()
-{
-  static TypeId tid = TypeId ("ns3::WifiMeshMultihopActionHeader")
-                      .SetParent<Header> ()
-                      .AddConstructor<WifiMeshMultihopActionHeader> ()
-                      ;
-  return tid;
-}
-
-TypeId
-WifiMeshMultihopActionHeader::GetInstanceTypeId () const
-{
-  return GetTypeId ();
-}
-
-void
-WifiMeshMultihopActionHeader::Print (std::ostream &os) const
-{
-}
-
-uint32_t
-WifiMeshMultihopActionHeader::GetSerializedSize () const
-{
-  return 2;
-}
-
-void
-WifiMeshMultihopActionHeader::Serialize (Buffer::Iterator start) const
-{
-  start.WriteU8 (m_category);
-  start.WriteU8 (m_actionValue);
-}
-
-uint32_t
-WifiMeshMultihopActionHeader::Deserialize (Buffer::Iterator start)
-{
-  Buffer::Iterator i = start;
-  m_category = i.ReadU8 ();
-  m_actionValue = i.ReadU8 ();
-  return i.GetDistanceFrom (start);
-}
-
-} // namespace ns3
--- a/src/devices/mesh/mesh-wifi-mac-header.h	Wed Apr 08 17:23:41 2009 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/* -*-  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;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * 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>
- */
-
-
-#ifndef MESH_WIFI_MAC_HEADER_H
-#define MESH_WIFI_MAC_HEADER_H
-
-#include "ns3/header.h"
-#include "ns3/mac48-address.h"
-
-namespace ns3 {
-/**
- * \ingroup mesh
- */
-class WifiMeshHeader : public Header //7.1.3.5b
-{
-public:
-  WifiMeshHeader ();
-  ~WifiMeshHeader ();
-  static TypeId GetTypeId ();
-  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   SetMeshSeqno (uint32_t seqno);
-  uint32_t  GetMeshSeqno () const;
-
-  void   SetMeshTtl (uint8_t TTL);
-  uint8_t  GetMeshTtl () 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 uint32_t Deserialize (Buffer::Iterator start);
-private:
-  uint8_t  m_meshFlags;
-  uint8_t  m_meshTtl;
-  uint32_t m_meshSeqno;
-  Mac48Address m_addr4;
-  Mac48Address m_addr5;
-  Mac48Address m_addr6;
-};
-
-/**
- * \ingroup mesh
- */
-class WifiMeshMultihopActionHeader : public Header //7.2.3.14
-{
-  //Multichop action frame consists of Mesh header, Action, and
-  //the last information. Mesh header is present within all data
-  //frames and multihop action frames, so Mesh header is a
-  //separate structure. Each MultihopAction frames (frames like
-  //PREQ, PREP and other) start form Category field and Action
-  //value field, so the Multihop Action Frame should containt
-  //three fields: Category, Action Value;
-public:
-  WifiMeshMultihopActionHeader ();
-  ~WifiMeshMultihopActionHeader ();
-  enum CategoryValue //table 7-24 staring from 4
-  {
-    MESH_PEER_LINK_MGT =4,
-    MESH_LINK_METRIC,
-    MESH_PATH_SELECTION,
-    MESH_INTERWORK_ACTION,
-    MESH_RESOURCE_COORDINATION,
-  };
-  enum PeerLinkMgtActionValue
-  {
-    PEER_LINK_OPEN = 0,
-    PEER_LINK_CONFIRM,
-    PEER_LINK_CLOSE,
-  };
-  enum LinkMetricActionValue
-  {
-    LINK_METRIC_REQUEST = 0,
-    LINK_METRIC_REPORT,
-  };
-  enum PathSelectionActionValue
-  {
-    PATH_REQUEST = 0,
-    PATH_REPLY,
-    PATH_ERROR,
-    ROOT_ANNOUNCEMENT,
-  };
-  enum InterworkActionValue
-  {
-    PORTAL_ANNOUNCEMENT = 0,
-  };
-  enum ResourceCoordinationActionValue
-  {
-    CONGESTION_CONTROL_NOTIFICATION = 0,
-    MDA_SETUP_REQUEST,
-    MDA_SETUP_REPLY,
-    MDAOP_ADVERTISMENT_REQUEST,
-    MDAOP_ADVERTISMENTS,
-    MDAOP_SET_TEARDOWN,
-    BEACON_TIMING_REQUEST,
-    BEACON_TIMING_RESPONSE,
-    TBTT_ADJASTMENT_REQUEST,
-    MESH_CHANNEL_SWITCH_ANNOUNCEMENT,
-  };
-  typedef union
-  {
-    enum PeerLinkMgtActionValue  peerLink;
-    enum LinkMetricActionValue  linkMetrtic;
-    enum PathSelectionActionValue  pathSelection;
-    enum InterworkActionValue  interwork;
-    enum ResourceCoordinationActionValue resourceCoordination;
-  } ACTION_VALUE;
-  void   SetAction (enum CategoryValue type,ACTION_VALUE action);
-  enum CategoryValue GetCategory ();
-  ACTION_VALUE  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 uint32_t Deserialize (Buffer::Iterator start);
-private:
-  uint8_t m_category;
-  uint8_t m_actionValue;
-};
-} // namespace ns3
-#endif /* MESH_WIFI_MAC_HEADER_H */
--- a/src/devices/mesh/wscript	Wed Apr 08 17:23:41 2009 +0400
+++ b/src/devices/mesh/wscript	Wed Apr 08 17:50:52 2009 +0400
@@ -3,15 +3,11 @@
 def build(bld):
     obj = bld.create_ns3_module('mesh', ['wifi', 'dot11s'])
     obj.source = [
-        # Refactored
         'wifi-information-element.cc',
         'mesh-point-device.cc',
         'mesh-l2-routing-protocol.cc',
         'mesh-wifi-beacon.cc',
         'mesh-wifi-interface-mac.cc',
-        # Not refactored
-        'mesh-wifi-mac-header.cc',
-        #'tx-statistics.cc',
         ]
     headers = bld.new_task_gen('ns3header')
     headers.module = 'mesh'
@@ -23,11 +19,5 @@
         'mesh-wifi-beacon.h',
         'mesh-wifi-interface-mac.h',
         'mesh-wifi-interface-mac-plugin.h',
-        # Dirty
-        #'tx-statistics.h',
-        'mesh-wifi-mac-header.h',
         ]
 
-#    obj = bld.create_ns3_program('wifi-phy-test',
-#        ['core', 'simulator', 'mobility', 'node', 'wifi'])
-#    obj.source = 'wifi-phy-test.cc'