Finished restructuring information elements
authorKirill Andreev <andreev@iitp.ru>
Wed, 18 Mar 2009 15:08:17 +0300
changeset 4838 ce31277d72ad
parent 4837 7887e457f6f0
child 4839 4bd2e8a8f8a0
Finished restructuring information elements
src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc
src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h
src/devices/mesh/802.11s/ie-dot11s-configuration.cc
src/devices/mesh/802.11s/ie-dot11s-configuration.h
src/devices/mesh/802.11s/ie-dot11s-peer-management.cc
src/devices/mesh/802.11s/ie-dot11s-peer-management.h
src/devices/mesh/802.11s/ie-dot11s-perr.cc
src/devices/mesh/802.11s/ie-dot11s-perr.h
src/devices/mesh/802.11s/ie-dot11s-prep.cc
src/devices/mesh/802.11s/ie-dot11s-prep.h
src/devices/mesh/802.11s/ie-dot11s-preq.cc
src/devices/mesh/802.11s/ie-dot11s-preq.h
src/devices/mesh/802.11s/ie-dot11s-rann.cc
src/devices/mesh/802.11s/ie-dot11s-rann.h
src/devices/mesh/802.11s/wscript
src/devices/mesh/dot11s-peer-management-element.cc
src/devices/mesh/dot11s-peer-management-element.h
src/devices/mesh/mesh-mgt-headers.cc
src/devices/mesh/mesh-mgt-headers.h
src/devices/mesh/mesh-wifi-mac.cc
src/devices/mesh/mesh-wifi-mac.h
src/devices/mesh/mesh-wifi-peer-manager.cc
src/devices/mesh/mesh-wifi-peer-manager.h
src/devices/mesh/wifi-information-element.h
src/devices/mesh/wscript
--- a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -145,7 +145,7 @@
 
 }
 
-uint16_t
+uint8_t
 IeDot11sBeaconTiming::GetInformationSize () const
 {
   return (5*m_numOfUnits);
@@ -167,7 +167,7 @@
     i.WriteHtonU16 ((*j)->GetBeaconInterval());
   }
 }
-uint16_t 
+uint8_t 
 IeDot11sBeaconTiming::DeserializeInformation (Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
--- a/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-beacon-timing.h	Wed Mar 18 15:08:17 2009 +0300
@@ -90,9 +90,9 @@
     return IE11S_BEACON_TIMING;
   }
   //Serialize-deserialize methods:
-  uint16_t  GetInformationSize () const;
+  uint8_t  GetInformationSize () const;
   void SerializeInformation (Buffer::Iterator i) const;
-  uint16_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
+  uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
   void PrintInformation(std::ostream& os) const; 
 private:
   static uint16_t TimestampToU16(Time x);
--- a/src/devices/mesh/802.11s/ie-dot11s-configuration.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-configuration.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -98,7 +98,7 @@
 {
   return GetTypeId();
 }
-uint16_t
+uint8_t
 IeDot11sConfiguration::GetInformationSize () const
 {
     return 1 // Version
@@ -124,7 +124,7 @@
     m_meshCap.Serialize (i);
 }
 
-uint16_t
+uint8_t
 IeDot11sConfiguration::DeserializeInformation (Buffer::Iterator i, uint8_t length)
 {
   Buffer::Iterator start = i;
--- a/src/devices/mesh/802.11s/ie-dot11s-configuration.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-configuration.h	Wed Mar 18 15:08:17 2009 +0300
@@ -102,10 +102,9 @@
   {
     return IE11S_MESH_CONFIGURATION;
   }
-
-  uint16_t  GetInformationSize () const;
+  uint8_t  GetInformationSize () const;
   void SerializeInformation (Buffer::Iterator i) const;
-  uint16_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
+  uint8_t DeserializeInformation (Buffer::Iterator i, uint8_t length);
   void PrintInformation(std::ostream& os) const;
   // TODO: Release and fill other fields in configuration
   // element
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/mesh/802.11s/ie-dot11s-peer-management.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -0,0 +1,133 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008,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
+ *
+ * Authors: Kirill Andreev <andreev@iitp.ru>
+ *          Aleksey Kovalenko <kovalenko@iitp.ru>
+ */
+
+
+#include "ns3/ie-dot11s-peer-management.h"
+#include "ns3/assert.h"
+
+
+//NS_LOG_COMPONENT_DEFINE ("MeshPeerLinkManagementelement");
+
+namespace ns3 {
+
+IeDot11sPeerManagement::IeDot11sPeerManagement ():
+    m_length(0),
+    m_subtype(PEER_OPEN),
+    m_localLinkId(0),
+    m_peerLinkId(0),
+    m_reasonCode(REASON11S_RESERVED)
+{}
+
+
+void
+IeDot11sPeerManagement::SetPeerOpen(uint16_t localLinkId)
+{
+  m_length = 3;
+  m_subtype = PEER_OPEN;
+  m_localLinkId = localLinkId;
+}
+void
+IeDot11sPeerManagement::SetPeerClose(uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode)
+{
+  m_length = 7;
+  m_subtype = PEER_CLOSE;
+  m_localLinkId = localLinkId;
+  m_peerLinkId = peerLinkId;
+  m_reasonCode = reasonCode;
+}
+
+void
+IeDot11sPeerManagement::SetPeerConfirm(uint16_t localLinkId, uint16_t peerLinkId)
+{
+  m_length = 5;
+  m_subtype = PEER_CONFIRM;
+  m_localLinkId = localLinkId;
+  m_peerLinkId = peerLinkId;
+}
+
+dot11sReasonCode
+IeDot11sPeerManagement::GetReasonCode() const
+  {
+    return m_reasonCode;
+  }
+
+uint16_t
+IeDot11sPeerManagement::GetLocalLinkId() const
+  {
+    return m_localLinkId;
+  }
+
+uint16_t
+IeDot11sPeerManagement::GetPeerLinkId() const
+  {
+    return m_peerLinkId;
+  }
+
+uint8_t
+IeDot11sPeerManagement::GetInformationSize (void) const
+  {
+    return m_length;
+  }
+
+bool
+IeDot11sPeerManagement::SubtypeIsOpen() const
+  {
+    return (m_subtype == PEER_OPEN);
+  }
+bool
+IeDot11sPeerManagement::SubtypeIsClose() const
+  {
+    return (m_subtype == PEER_CLOSE);
+  }
+bool
+IeDot11sPeerManagement::SubtypeIsConfirm() const
+  {
+    return (m_subtype == PEER_CONFIRM);
+  }
+
+void
+IeDot11sPeerManagement::SerializeInformation (Buffer::Iterator i) const
+  {
+    i.WriteU8(m_subtype);
+    i.WriteHtonU16(m_localLinkId);
+    if (m_length > 3)
+      i.WriteHtonU16(m_peerLinkId);
+    if (m_length > 5)
+      i.WriteHtonU16(m_reasonCode);
+  }
+uint8_t
+IeDot11sPeerManagement::DeserializeInformation (Buffer::Iterator start, uint8_t length)
+{
+  Buffer::Iterator i = start;
+  m_subtype  = i.ReadU8();
+  m_localLinkId  = i.ReadNtohU16();
+  if (m_length > 3)
+    m_peerLinkId = i.ReadNtohU16();
+  if (m_length > 5)
+    m_reasonCode = (dot11sReasonCode)i.ReadNtohU16();
+  return i.GetDistanceFrom(start);
+}
+void
+IeDot11sPeerManagement::PrintInformation(std::ostream& os) const
+{
+  //TODO
+}
+} //namespace NS3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/mesh/802.11s/ie-dot11s-peer-management.h	Wed Mar 18 15:08:17 2009 +0300
@@ -0,0 +1,72 @@
+/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008,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
+ *
+ * Authors: Kirill Andreev <andreev@iitp.ru>
+ *          Aleksey Kovalenko <kovalenko@iitp.ru>
+ */
+
+
+#ifndef MESH_PEER_MAN_ELEMENT
+#define MESH_PEER_MAN_ELEMENT
+
+#include <stdint.h>
+#include "ns3/buffer.h"
+#include "ns3/dot11s-codes.h"
+#include "ns3/wifi-information-element.h"
+
+namespace ns3 {
+/**
+ * \ingroup mesh
+ */
+class IeDot11sPeerManagement : public WifiInformationElement
+{
+public:
+  enum Subtype {
+    PEER_OPEN    = 0,
+    PEER_CLOSE   = 1,
+    PEER_CONFIRM = 2,
+  };
+public:
+  IeDot11sPeerManagement ();
+
+  void   SetPeerOpen(uint16_t localLinkId);
+  void   SetPeerClose(uint16_t localLinkID, uint16_t peerLinkId, dot11sReasonCode reasonCode);
+  void   SetPeerConfirm(uint16_t localLinkID, uint16_t peerLinkId);
+
+  dot11sReasonCode GetReasonCode() const;
+  uint16_t  GetLocalLinkId() const;
+  uint16_t  GetPeerLinkId() const;
+  bool   SubtypeIsOpen() const;
+  bool   SubtypeIsClose() const;
+  bool   SubtypeIsConfirm() const ;
+protected:
+  WifiElementId ElementId() const{
+    return IE11S_PEER_LINK_MANAGEMENT;
+  }
+  uint8_t  GetInformationSize (void) const;
+  void SerializeInformation (Buffer::Iterator i) const;
+  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; //always is present
+  uint16_t  m_peerLinkId; //only in confirm and may be present in close frame
+  dot11sReasonCode m_reasonCode; //only in close frame
+};
+} //namespace NS3
+#endif
--- a/src/devices/mesh/802.11s/ie-dot11s-perr.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-perr.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -65,7 +65,7 @@
         i.WriteHtonU32 (m_addressUnits[j].seqnum);
       }
   }
-uint16_t
+uint8_t
 IeDot11sPerr::DeserializeInformation(Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
@@ -83,10 +83,10 @@
   return i.GetDistanceFrom(start);
 }
 
-uint16_t
+uint8_t
 IeDot11sPerr::GetInformationSize() const
   {
-    uint16_t retval =
+    uint8_t retval =
        1 //ModeFlags
       +1 //NumOfDests
       +6*m_numOfDest
--- a/src/devices/mesh/802.11s/ie-dot11s-perr.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-perr.h	Wed Mar 18 15:08:17 2009 +0300
@@ -59,9 +59,9 @@
     return IE11S_PERR;
   };
   void  SerializeInformation(Buffer::Iterator i) const;
-  uint16_t  DeserializeInformation(Buffer::Iterator start, uint8_t length);
+  uint8_t  DeserializeInformation(Buffer::Iterator start, uint8_t length);
   void PrintInformation(std::ostream& os) const;
-  uint16_t  GetInformationSize() const;
+  uint8_t  GetInformationSize() const;
 private:
   uint8_t   m_numOfDest;
   std::vector<HwmpRtable::FailedDestination>
--- a/src/devices/mesh/802.11s/ie-dot11s-prep.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-prep.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -175,7 +175,7 @@
     WriteTo (i, m_originatorAddress);
     i.WriteHtonU32 (m_originatorSeqNumber);
   }
-uint16_t
+uint8_t
 IeDot11sPrep::DeserializeInformation(Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
@@ -190,7 +190,7 @@
   m_originatorSeqNumber = i.ReadNtohU32();
   return i.GetDistanceFrom(start);
 }
-uint16_t
+uint8_t
 IeDot11sPrep::GetInformationSize() const
   {
     uint32_t retval =
--- a/src/devices/mesh/802.11s/ie-dot11s-prep.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-prep.h	Wed Mar 18 15:08:17 2009 +0300
@@ -70,8 +70,8 @@
     return IE11S_PREP;
   }
   void SerializeInformation(Buffer::Iterator i) const;
-  uint16_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
-  uint16_t GetInformationSize() const;
+  uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
+  uint8_t GetInformationSize() const;
   void PrintInformation(std::ostream& os) const;
 private:
   uint8_t  m_flags;
--- a/src/devices/mesh/802.11s/ie-dot11s-preq.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-preq.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -275,7 +275,7 @@
       }
   }
 
-uint16_t
+uint8_t
 IeDot11sPreq::DeserializeInformation(Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
@@ -311,10 +311,10 @@
     }
   return i.GetDistanceFrom(start);
 }
-uint16_t
+uint8_t
 IeDot11sPreq::GetInformationSize() const
 {
-  uint32_t retval =
+  uint8_t retval =
     1 //Flags
     +1 //Hopcount
     +1 //TTL
--- a/src/devices/mesh/802.11s/ie-dot11s-preq.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-preq.h	Wed Mar 18 15:08:17 2009 +0300
@@ -108,8 +108,8 @@
     return IE11S_PREQ;
   }
   void SerializeInformation(Buffer::Iterator i) const;
-  uint16_t DeserializeInformation(Buffer::Iterator i, uint8_t length);
-  uint16_t GetInformationSize() const;
+  uint8_t DeserializeInformation(Buffer::Iterator i, uint8_t length);
+  uint8_t GetInformationSize() const;
   void PrintInformation(std::ostream& os) const;
 private:
   //how many destinations we support
--- a/src/devices/mesh/802.11s/ie-dot11s-rann.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-rann.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -124,7 +124,7 @@
     i.WriteHtonU32 (m_destSeqNumber);
     i.WriteHtonU32 (m_metric);
   }
-uint16_t
+uint8_t
 IeDot11sRann::DeserializeInformation(Buffer::Iterator start, uint8_t length)
 {
   Buffer::Iterator i = start;
@@ -136,10 +136,10 @@
   m_metric = i.ReadNtohU32();
   return i.GetDistanceFrom(start);
 }
-uint16_t
+uint8_t
 IeDot11sRann::GetInformationSize() const
   {
-    uint16_t retval =
+    uint8_t retval =
       1//Flags
       +1//Hopcount
       +1//TTL
--- a/src/devices/mesh/802.11s/ie-dot11s-rann.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/ie-dot11s-rann.h	Wed Mar 18 15:08:17 2009 +0300
@@ -62,8 +62,8 @@
     return IE11S_RANN;
   }
   void SerializeInformation(Buffer::Iterator i) const;
-  uint16_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
-  uint16_t GetInformationSize() const;
+  uint8_t DeserializeInformation(Buffer::Iterator start, uint8_t length);
+  uint8_t GetInformationSize() const;
 private:
   uint8_t m_flags;
   uint8_t m_hopcount;
--- a/src/devices/mesh/802.11s/wscript	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/802.11s/wscript	Wed Mar 18 15:08:17 2009 +0300
@@ -5,6 +5,7 @@
     obj.source = [
         'ie-dot11s-beacon-timing.cc',
         'ie-dot11s-configuration.cc',
+        'ie-dot11s-peer-management.cc',
         'ie-dot11s-preq.cc',
         'ie-dot11s-prep.cc',
         'ie-dot11s-perr.cc',
@@ -15,6 +16,7 @@
     headers.source = [
         'ie-dot11s-beacon-timing.h',
         'ie-dot11s-configuration.h',
+        'ie-dot11s-peer-management.h',
         'ie-dot11s-preq.h',
         'ie-dot11s-prep.h',
         'ie-dot11s-perr.h',
--- a/src/devices/mesh/dot11s-peer-management-element.cc	Wed Mar 18 14:36:00 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2008,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
- *
- * Authors: Kirill Andreev <andreev@iitp.ru>
- *          Aleksey Kovalenko <kovalenko@iitp.ru>
- */
-
-
-#include "ns3/dot11s-peer-management-element.h"
-#include "ns3/assert.h"
-
-
-//NS_LOG_COMPONENT_DEFINE ("MeshPeerLinkManagementelement");
-
-namespace ns3 {
-
-PeerLinkManagementElement::PeerLinkManagementElement ():
-    m_length(0),
-    m_subtype(PEER_OPEN),
-    m_localLinkId(0),
-    m_peerLinkId(0),
-    m_reasonCode(REASON11S_RESERVED)
-{}
-
-
-void
-PeerLinkManagementElement::SetPeerOpen(uint16_t localLinkId)
-{
-  m_length = 3;
-  m_subtype = PEER_OPEN;
-  m_localLinkId = localLinkId;
-}
-void
-PeerLinkManagementElement::SetPeerClose(uint16_t localLinkId, uint16_t peerLinkId, dot11sReasonCode reasonCode)
-{
-  m_length = 7;
-  m_subtype = PEER_CLOSE;
-  m_localLinkId = localLinkId;
-  m_peerLinkId = peerLinkId;
-  m_reasonCode = reasonCode;
-}
-
-void
-PeerLinkManagementElement::SetPeerConfirm(uint16_t localLinkId, uint16_t peerLinkId)
-{
-  m_length = 5;
-  m_subtype = PEER_CONFIRM;
-  m_localLinkId = localLinkId;
-  m_peerLinkId = peerLinkId;
-}
-
-dot11sReasonCode
-PeerLinkManagementElement::GetReasonCode() const
-  {
-    return m_reasonCode;
-  }
-
-uint16_t
-PeerLinkManagementElement::GetLocalLinkId() const
-  {
-    return m_localLinkId;
-  }
-
-uint16_t
-PeerLinkManagementElement::GetPeerLinkId() const
-  {
-    return m_peerLinkId;
-  }
-
-uint32_t
-PeerLinkManagementElement::GetSerializedSize (void) const
-  {
-    return m_length+2;
-  }
-
-bool
-PeerLinkManagementElement::SubtypeIsOpen() const
-  {
-    return (m_subtype == PEER_OPEN);
-  }
-bool
-PeerLinkManagementElement::SubtypeIsClose() const
-  {
-    return (m_subtype == PEER_CLOSE);
-  }
-bool
-PeerLinkManagementElement::SubtypeIsConfirm() const
-  {
-    return (m_subtype == PEER_CONFIRM);
-  }
-
-Buffer::Iterator
-PeerLinkManagementElement::Serialize (Buffer::Iterator i) const
-  {
-    i.WriteU8(ElementId());
-    i.WriteU8(m_length);
-    i.WriteU8(m_subtype);
-    i.WriteHtonU16(m_localLinkId);
-    if (m_length > 3)
-      i.WriteHtonU16(m_peerLinkId);
-    if (m_length > 5)
-      i.WriteHtonU16(m_reasonCode);
-    return i;
-  }
-Buffer::Iterator
-PeerLinkManagementElement::Deserialize (Buffer::Iterator i)
-{
-  NS_ASSERT(ElementId() == i.ReadU8());
-  m_length   = i.ReadU8();
-  m_subtype  = i.ReadU8();
-  m_localLinkId  = i.ReadNtohU16();
-  if (m_length > 3)
-    m_peerLinkId = i.ReadNtohU16();
-  if (m_length > 5)
-    m_reasonCode = (dot11sReasonCode)i.ReadNtohU16();
-  return i;
-}
-} //namespace NS3
--- a/src/devices/mesh/dot11s-peer-management-element.h	Wed Mar 18 14:36:00 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2008,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
- *
- * Authors: Kirill Andreev <andreev@iitp.ru>
- *          Aleksey Kovalenko <kovalenko@iitp.ru>
- */
-
-
-#ifndef MESH_PEER_MAN_ELEMENT
-#define MESH_PEER_MAN_ELEMENT
-
-#include <stdint.h>
-#include "ns3/buffer.h"
-#include "ns3/dot11s-codes.h"
-
-namespace ns3 {
-/**
- * \ingroup mesh
- */
-class PeerLinkManagementElement
-{
-public:
-  enum Subtype {
-    PEER_OPEN    = 0,
-    PEER_CLOSE   = 1,
-    PEER_CONFIRM = 2,
-  };
-public:
-  PeerLinkManagementElement ();
-
-  void   SetPeerOpen(uint16_t localLinkId);
-  void   SetPeerClose(uint16_t localLinkID, uint16_t peerLinkId, dot11sReasonCode reasonCode);
-  void   SetPeerConfirm(uint16_t localLinkID, uint16_t peerLinkId);
-
-  dot11sReasonCode GetReasonCode() const;
-  uint16_t  GetLocalLinkId() const;
-  uint16_t  GetPeerLinkId() const;
-  bool   SubtypeIsOpen() const;
-  bool   SubtypeIsClose() const;
-  bool   SubtypeIsConfirm() const ;
-
-  uint32_t  GetSerializedSize (void) const;
-  Buffer::Iterator Serialize (Buffer::Iterator i) const;
-  Buffer::Iterator Deserialize (Buffer::Iterator i);
-private:
-  static uint8_t ElementId() {
-    return (uint8_t)IE11S_PEER_LINK_MANAGEMENT;
-  }
-  uint8_t   m_length;
-  uint8_t   m_subtype;
-  uint16_t  m_localLinkId; //always is present
-  uint16_t  m_peerLinkId; //only in confirm and may be present in close frame
-  dot11sReasonCode m_reasonCode; //only in close frame
-};
-} //namespace NS3
-#endif
--- a/src/devices/mesh/mesh-mgt-headers.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/mesh-mgt-headers.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -138,7 +138,7 @@
 }
 
 void
-MeshMgtPeerLinkManFrame::SetPeerLinkManagementElement(PeerLinkManagementElement MeshPeerElement)
+MeshMgtPeerLinkManFrame::SetIeDot11sPeerManagement(IeDot11sPeerManagement MeshPeerElement)
 {
   PeerLinkMan = MeshPeerElement;
 }
@@ -173,8 +173,8 @@
   return MeshConfig;
 }
 
-PeerLinkManagementElement
-MeshMgtPeerLinkManFrame::GetPeerLinkManagementElement()
+IeDot11sPeerManagement
+MeshMgtPeerLinkManFrame::GetIeDot11sPeerManagement()
 {
   return PeerLinkMan;
 }
@@ -236,7 +236,8 @@
         MeshConfig.Serialize (i);
         i.Next(MeshConfig.GetSerializedSize());
       }
-    i = PeerLinkMan.Serialize (i);
+    PeerLinkMan.Serialize (i);
+    i.Next(PeerLinkMan.GetSerializedSize());
   }
 
 uint32_t
@@ -254,7 +255,8 @@
       MeshConfig.Deserialize (i);
       i.Next(MeshConfig.GetSerializedSize());
     }
-  i = PeerLinkMan.Deserialize (i);
+  PeerLinkMan.Deserialize (i);
+  i.Next(PeerLinkMan.GetSerializedSize());
   return i.GetDistanceFrom (start);
 }
 void
--- a/src/devices/mesh/mesh-mgt-headers.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/mesh-mgt-headers.h	Wed Mar 18 15:08:17 2009 +0300
@@ -27,8 +27,8 @@
 
 #include "ns3/header.h"
 #include "ns3/status-code.h"
-#include "ns3/dot11s-peer-management-element.h"
 #include "ns3/supported-rates.h"
+#include "ns3/ie-dot11s-peer-management.h"
 #include "ns3/ie-dot11s-preq.h"
 #include "ns3/ie-dot11s-prep.h"
 #include "ns3/ie-dot11s-perr.h"
@@ -70,14 +70,14 @@
   void    SetQosField(uint16_t qos);
   void    SetMeshId(Ssid Id);
   void    SetIeDot11sConfiguration(IeDot11sConfiguration MeshConf);
-  void    SetPeerLinkManagementElement(PeerLinkManagementElement MeshPeerElement);
+  void    SetIeDot11sPeerManagement(IeDot11sPeerManagement MeshPeerElement);
 
   uint16_t         GetAid();
   SupportedRates   GetSupportedRates();
   uint16_t         GetQosField();
   Ssid             GetMeshId();
   IeDot11sConfiguration  GetIeDot11sConfiguration();
-  PeerLinkManagementElement GetPeerLinkManagementElement();
+  IeDot11sPeerManagement GetIeDot11sPeerManagement();
 
   static  TypeId   GetTypeId();
   virtual TypeId   GetInstanceTypeId() const;
@@ -101,14 +101,14 @@
   static const uint8_t MESH_MGT_HEADER_PEER_CLOSE = 3;
   // Standart is also requires a ReasonCode to be within
   // PeerLinkClose frame format, but it is present within
-  // PeerLinkManagementElement, so we did not duplicate
+  // IeDot11sPeerManagement, so we did not duplicate
   // it.
   uint16_t   Aid;  //only in Confirm
   SupportedRates   Rates;  //only in Open and Confirm
   uint16_t   QoS;  //only in Open and Confirm
   Ssid    MeshId;  //only in Open and Confirm
   IeDot11sConfiguration MeshConfig; //only in Open and Confirm
-  PeerLinkManagementElement PeerLinkMan; //in all types of frames
+  IeDot11sPeerManagement PeerLinkMan; //in all types of frames
 };
 
 }//namespace NS3
--- a/src/devices/mesh/mesh-wifi-mac.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-mac.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -578,7 +578,7 @@
                 GetAddress(),
                 peerAddress,
                 peer_frame.GetAid(),
-                peer_frame.GetPeerLinkManagementElement(),
+                peer_frame.GetIeDot11sPeerManagement(),
                 m_meshConfig
               );
               return;
@@ -586,7 +586,7 @@
               m_peerManager->SetOpenReceived(
                 GetAddress(),
                 peerAddress,
-                peer_frame.GetPeerLinkManagementElement(),
+                peer_frame.GetIeDot11sPeerManagement(),
                 m_meshConfig
               );
               return;
@@ -594,7 +594,7 @@
               m_peerManager->SetCloseReceived(
                 GetAddress(),
                 peerAddress,
-                peer_frame.GetPeerLinkManagementElement()
+                peer_frame.GetIeDot11sPeerManagement()
               );
               return;
             default:
@@ -677,34 +677,34 @@
 }
 
 void
-MeshWifiMac::SendPeerLinkOpen(PeerLinkManagementElement peer_element, Mac48Address peerAddress)
+MeshWifiMac::SendPeerLinkOpen(IeDot11sPeerManagement peer_element, Mac48Address peerAddress)
 {
   MeshMgtPeerLinkManFrame open;
   open.SetOpen();
   open.SetIeDot11sConfiguration(m_meshConfig);
-  open.SetPeerLinkManagementElement(peer_element);
+  open.SetIeDot11sPeerManagement(peer_element);
   Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, open, peerAddress);
 }
 
 void
-MeshWifiMac::SendPeerLinkConfirm(PeerLinkManagementElement peer_element, Mac48Address peerAddress, uint16_t aid)
+MeshWifiMac::SendPeerLinkConfirm(IeDot11sPeerManagement peer_element, Mac48Address peerAddress, uint16_t aid)
 {
   MeshMgtPeerLinkManFrame confirm;
   confirm.SetConfirm();
   confirm.SetIeDot11sConfiguration(m_meshConfig);
-  confirm.SetPeerLinkManagementElement(peer_element);
+  confirm.SetIeDot11sPeerManagement(peer_element);
   confirm.SetAid(aid);
   Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, confirm, peerAddress);
 
 }
 
 void
-MeshWifiMac::SendPeerLinkClose(PeerLinkManagementElement peer_element, Mac48Address peerAddress)
+MeshWifiMac::SendPeerLinkClose(IeDot11sPeerManagement peer_element, Mac48Address peerAddress)
 {
   MeshMgtPeerLinkManFrame close;
   close.SetClose();
   close.SetIeDot11sConfiguration(m_meshConfig);
-  close.SetPeerLinkManagementElement(peer_element);
+  close.SetIeDot11sPeerManagement(peer_element);
   Simulator::Schedule(CalcSwDelay() ,&MeshWifiMac::QueuePeerLinkFrame, this, close, peerAddress);
 
 }
--- a/src/devices/mesh/mesh-wifi-mac.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-mac.h	Wed Mar 18 15:08:17 2009 +0300
@@ -202,7 +202,7 @@
    * destination of given frame
    */
   void   SendPeerLinkOpen(
-    PeerLinkManagementElement peer_element,
+    IeDot11sPeerManagement peer_element,
     Mac48Address peerAddress
   );
   /**
@@ -217,7 +217,7 @@
    * peer manager
    */
   void   SendPeerLinkConfirm(
-    PeerLinkManagementElement peer_element,
+    IeDot11sPeerManagement peer_element,
     Mac48Address peerAddress,
     uint16_t aid
   );
@@ -231,7 +231,7 @@
    * destination of given frame
    */
   void   SendPeerLinkClose(
-    PeerLinkManagementElement peer_element,
+    IeDot11sPeerManagement peer_element,
     Mac48Address peerAddress
   );
   /**
--- a/src/devices/mesh/mesh-wifi-peer-manager.cc	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-peer-manager.cc	Wed Mar 18 15:08:17 2009 +0300
@@ -498,14 +498,14 @@
 
 void WifiPeerLinkDescriptor::SendPeerLinkClose(dot11sReasonCode reasoncode)
 {
-  PeerLinkManagementElement peerElement;
+  IeDot11sPeerManagement peerElement;
   peerElement.SetPeerClose(m_localLinkId, m_peerLinkId, reasoncode);
   m_mac->SendPeerLinkClose(peerElement,m_peerAddress);
 }
 
 void WifiPeerLinkDescriptor::SendPeerLinkOpen()
 {
-  PeerLinkManagementElement peerElement;
+  IeDot11sPeerManagement peerElement;
   peerElement.SetPeerOpen(m_localLinkId);
   NS_ASSERT(m_mac != NULL);
   m_mac->SendPeerLinkOpen(peerElement, m_peerAddress);
@@ -513,7 +513,7 @@
 
 void WifiPeerLinkDescriptor::SendPeerLinkConfirm()
 {
-  PeerLinkManagementElement peerElement;
+  IeDot11sPeerManagement peerElement;
   peerElement.SetPeerConfirm(m_localLinkId, m_peerLinkId);
   m_mac->SendPeerLinkConfirm(peerElement, m_peerAddress, m_assocId);
 }
@@ -694,7 +694,7 @@
 WifiPeerManager::SetOpenReceived(
   Mac48Address portAddress,
   Mac48Address peerAddress,
-  PeerLinkManagementElement peerMan,
+  IeDot11sPeerManagement peerMan,
   IeDot11sConfiguration conf
 )
 {
@@ -724,7 +724,7 @@
   Mac48Address portAddress,
   Mac48Address peerAddress,
   uint16_t peerAid,
-  PeerLinkManagementElement peerMan,
+  IeDot11sPeerManagement peerMan,
   IeDot11sConfiguration meshConfig
 )
 {
@@ -739,7 +739,7 @@
 WifiPeerManager::SetCloseReceived(
   Mac48Address portAddress,
   Mac48Address peerAddress,
-  PeerLinkManagementElement peerMan
+  IeDot11sPeerManagement peerMan
 )
 {
   PeerDescriptorsMap::iterator port = m_peerDescriptors.find(portAddress);
--- a/src/devices/mesh/mesh-wifi-peer-manager.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/mesh-wifi-peer-manager.h	Wed Mar 18 15:08:17 2009 +0300
@@ -29,7 +29,7 @@
 #include "ns3/mac48-address.h"
 #include "ns3/uinteger.h"
 #include "ns3/wifi-net-device.h"
-#include "ns3/dot11s-peer-management-element.h"
+#include "ns3/ie-dot11s-peer-management.h"
 #include "ns3/ie-dot11s-beacon-timing.h"
 #include "ns3/mesh-wifi-mac.h"
 
@@ -69,7 +69,7 @@
   void  SetPeerAid(uint16_t aid);
   void  SetBeaconTimingElement(IeDot11sBeaconTiming beaconTiming);
   void  SetPeerLinkDescriptorElement(
-    PeerLinkManagementElement peerLinkElement
+    IeDot11sPeerManagement peerLinkElement
   );
   Mac48Address GetPeerAddress()const;
   /**
@@ -81,7 +81,7 @@
   Time  GetBeaconInterval()const;
   IeDot11sBeaconTiming
   GetBeaconTimingElement()const;
-  PeerLinkManagementElement
+  IeDot11sPeerManagement
   GetPeerLinkDescriptorElement()const;
   void  ClearTimingElement();
   /* MLME */
@@ -232,7 +232,7 @@
   void SetOpenReceived(
     Mac48Address portAddress,
     Mac48Address peerAddress,
-    PeerLinkManagementElement
+    IeDot11sPeerManagement
     peerMan,
     IeDot11sConfiguration conf
   );
@@ -240,14 +240,14 @@
     Mac48Address portAddress,
     Mac48Address peerAddress,
     uint16_t peerAid,
-    PeerLinkManagementElement
+    IeDot11sPeerManagement
     peerMan,
     IeDot11sConfiguration meshConfig
   );
   void SetCloseReceived(
     Mac48Address portAddress,
     Mac48Address peerAddress,
-    PeerLinkManagementElement peerMan
+    IeDot11sPeerManagement peerMan
   );
   //Using this function MAC
   void ConfigurationMismatch(
--- a/src/devices/mesh/wifi-information-element.h	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/wifi-information-element.h	Wed Mar 18 15:08:17 2009 +0300
@@ -134,11 +134,11 @@
   /// Own unique Element ID
   virtual WifiElementId ElementId () const = 0;
   /// Length of serialized information
-  virtual uint16_t GetInformationSize () const = 0;
+  virtual uint8_t GetInformationSize () const = 0;
   /// Serialize information
   virtual void SerializeInformation (Buffer::Iterator start) const = 0;
   /// Deserialize information
-  virtual uint16_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
+  virtual uint8_t DeserializeInformation (Buffer::Iterator start, uint8_t length) = 0;
   /// Print information
   virtual void PrintInformation (std::ostream &os) const = 0;
   //\}
--- a/src/devices/mesh/wscript	Wed Mar 18 14:36:00 2009 +0300
+++ b/src/devices/mesh/wscript	Wed Mar 18 15:08:17 2009 +0300
@@ -18,7 +18,6 @@
         'hwmp.cc',
         'mesh-wifi-mac.cc',
         'hwmp-state.cc',
-        'dot11s-peer-management-element.cc',
         'mesh-mgt-headers.cc',
         ]
     headers = bld.new_task_gen('ns3header')
@@ -36,7 +35,6 @@
         'mesh-mgt-headers.h',
         'hwmp.h',
         'tx-statistics.h',
-        'dot11s-peer-management-element.h',
         'hwmp-rtable.h',
         'mesh-wifi-peer-manager.h',
         'mesh-wifi-mac-header.h',