Headers: structured
authorKirill Andreev <andreev@iitp.ru>
Wed, 02 Sep 2009 14:58:36 +0400
changeset 5177 2d82457e44dc
parent 5176 31ff7abd6f4e
child 5178 fa7d9b667efc
Headers: structured
src/devices/mesh/dot11s/hwmp-protocol.h
src/devices/mesh/dot11s/peer-link.h
src/devices/mesh/dot11s/peer-management-protocol-mac.h
src/devices/mesh/dot11s/peer-management-protocol.h
src/devices/mesh/mesh-point-device.h
src/devices/mesh/mesh-wifi-interface-mac.h
src/devices/mesh/wifi-information-element-vector.h
--- a/src/devices/mesh/dot11s/hwmp-protocol.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.h	Wed Sep 02 14:58:36 2009 +0400
@@ -86,7 +86,28 @@
   void ResetStats ();
 private:
   friend class HwmpProtocolMac;
+  /**
+   * \brief Structure of path error: IePerr and list of receivers:
+   * interfaces and MAC address
+   */
+  struct PathError
+  {
+    std::vector<FailedDestination> destinations; ///< destination list: Mac48Address and sequence number
+    std::vector<std::pair<uint32_t, Mac48Address> > receivers; ///< list of PathError receivrs (in case of unicast PERR)
+  };
+  /// Packet waiting its routing information
+  struct QueuedPacket
+  {
+    Ptr<Packet> pkt; ///< the packet
+    Mac48Address src; ///< src address
+    Mac48Address dst; ///< dst address
+    uint16_t protocol; ///< protocol number
+    uint32_t inInterface; ///< incoming device interface ID. (if packet has come from upper layers, this is Mesh point ID)
+    RouteReplyCallback reply; ///< how to reply
 
+    QueuedPacket ();
+  };
+  typedef std::map<uint32_t, Ptr<HwmpProtocolMac> > HwmpProtocolMacMap;
   /// Like RequestRoute, but for unicast packets
   bool ForwardUnicast (uint32_t  sourceIface, const Mac48Address source, const Mac48Address destination,
       Ptr<Packet>  packet, uint16_t  protocolType, RouteReplyCallback  routeReply, uint32_t ttl);
@@ -106,16 +127,6 @@
       uint32_t lifetime,
       uint32_t interface);
   /**
-   * \brief Structure of path error: IePerr and list of receivers:
-   * interfaces and MAC address
-   */
-  struct PathError
-  {
-    std::vector<FailedDestination> destinations;
-    /// interface-address
-    std::vector<std::pair<uint32_t, Mac48Address> > receivers;
-  };
-  /**
    * \brief forms a path error information element when list of destination fails on a given interface
    * \attention removes all entries from routing table!
    */
@@ -141,19 +152,6 @@
    */
   bool DropDataFrame (uint32_t seqno, Mac48Address source);
   //\}
-private:
-  /// Packet waiting its routing information
-  struct QueuedPacket {
-    Ptr<Packet> pkt; ///< the packet
-    Mac48Address src; ///< src address
-    Mac48Address dst; ///< dst address
-    uint16_t protocol; ///< protocol number
-    uint32_t inInterface; ///< incoming device interface ID. (if packet has come from upper layers, this is Mesh point ID)
-    RouteReplyCallback reply; ///< how to reply
-
-    QueuedPacket ();
-  };
-
   ///\name Methods related to Queue/Dequeue procedures
   ///\{
   bool QueuePacket (QueuedPacket packet);
@@ -177,17 +175,24 @@
    * When PREQ retry has achieved the maximum level - retry mechanism should be canceled
    */
   void  RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry);
-  ///\}
-
-  ///\name Proactive Preq routines:
-  ///\{
+  /// Proactive Preq routines:
   void SendProactivePreq ();
   ///\}
   ///\return address of MeshPointDevice
   Mac48Address GetAddress ();
+  ///\name Methods needed by HwmpMacLugin to access protocol parameters:
+  ///\{
+  bool GetDoFlag ();
+  bool GetRfFlag ();
+  Time GetPreqMinInterval ();
+  Time GetPerrMinInterval ();
+  uint8_t GetMaxTtl ();
+  uint32_t GetNextPreqId ();
+  uint32_t GetNextHwmpSeqno ();
+  uint32_t GetActivePathLifetime ();
+  uint8_t GetUnicastPerrThreshold ();
+  ///\}
 private:
-  typedef std::map<uint32_t, Ptr<HwmpProtocolMac> > HwmpProtocolMacMap;
-  HwmpProtocolMacMap m_interfaces;
   ///\name Statistics:
   ///\{
   struct Statistics
@@ -207,6 +212,7 @@
   };
   Statistics m_stats;
   ///\}
+  HwmpProtocolMacMap m_interfaces;
   Mac48Address m_address;
   uint32_t m_dataSeqno;
   uint32_t m_hwmpSeqno;
@@ -231,10 +237,8 @@
   /// Random start in Proactive PREQ propagation
   Time m_randomStart;
   ///\}
-
   /// Packet Queue
   std::vector<QueuedPacket> m_rqueue;
-private:
   ///\name HWMP-protocol parameters (attributes of GetTypeId)
   ///\{
   uint16_t m_maxQueueSize;
@@ -254,19 +258,6 @@
   bool m_doFlag;
   bool m_rfFlag;
   ///\}
-
-  ///\name Methods needed by HwmpMacLugin to access protocol parameters:
-  ///\{
-  bool GetDoFlag ();
-  bool GetRfFlag ();
-  Time GetPreqMinInterval ();
-  Time GetPerrMinInterval ();
-  uint8_t GetMaxTtl ();
-  uint32_t GetNextPreqId ();
-  uint32_t GetNextHwmpSeqno ();
-  uint32_t GetActivePathLifetime ();
-  uint8_t GetUnicastPerrThreshold ();
-  ///\}
   Callback <std::vector<Mac48Address>, uint32_t> m_neighboursCallback;
 };
 } //namespace dot11s
--- a/src/devices/mesh/dot11s/peer-link.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-link.h	Wed Sep 02 14:58:36 2009 +0400
@@ -48,7 +48,15 @@
   PeerLink ();
   ~PeerLink ();
   void DoDispose ();
-
+  /// Peer Link state:
+  enum  PeerState {
+    IDLE,
+    OPN_SNT,
+    CNF_RCVD,
+    OPN_RCVD,
+    ESTAB,
+    HOLDING,
+  };
   /// Process beacon received from peer
   void SetBeaconInformation (Time lastBeacon, Time BeaconInterval);
   /**
@@ -89,14 +97,6 @@
   void MLMEActivePeerLinkOpen ();
   /// MLME-PeeringRequestReject
   void MLMEPeeringRequestReject ();
-  enum  PeerState {
-    IDLE,
-    OPN_SNT,
-    CNF_RCVD,
-    OPN_RCVD,
-    ESTAB,
-    HOLDING,
-  };
   /// Callback type for MLME-SignalPeerLinkStatus event
   typedef Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerState, PeerLink::PeerState> SignalStatusCallback;
   /// Set callback
@@ -108,6 +108,24 @@
   ///\brief Statistics
   void Report (std::ostream & os) const;
 private:
+  /// Peer link events, see 802.11s draft 11B.3.3.2
+  enum  PeerEvent
+  {
+    CNCL,       ///< Cancel peer link
+    ACTOPN,     ///< Active peer link open
+    CLS_ACPT,   ///< PeerLinkClose_Accept
+    OPN_ACPT,   ///< PeerLinkOpen_Accept
+    OPN_RJCT,   ///< PeerLinkOpen_Reject
+    REQ_RJCT,   ///< PeerLinkOpenReject by internal reason
+    CNF_ACPT,   ///< PeerLinkConfirm_Accept
+    CNF_RJCT,   ///< PeerLinkConfirm_Reject
+    TOR1,       ///< Timeout of retry timer
+    TOR2,       ///< also timeout of retry timer
+    TOC,        ///< Timeout of confirm timer
+    TOH,        ///< Timeout of holding (gracefull closing) timer
+  };
+  /// State transition
+  void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED);
   /**
    * \name Link response to received management frames
    *
@@ -139,7 +157,6 @@
     PmpReasonCode reason
   );
   //\}
-
   /// True if link is established
   bool  LinkIsEstab () const;
   /// True if link is idle. Link can be deleted in this state
@@ -149,29 +166,6 @@
    * link management frames
    */
   void SetMacPlugin (Ptr<PeerManagementProtocolMac> plugin);
-  /// Peer link states, see 802.11s draft 11B.3.3.1
-private:
-  /// Peer link events, see 802.11s draft 11B.3.3.2
-  enum  PeerEvent
-  {
-    CNCL,       ///< Cancel peer link
-    ACTOPN,     ///< Active peer link open
-    CLS_ACPT,   ///< PeerLinkClose_Accept
-    OPN_ACPT,   ///< PeerLinkOpen_Accept
-    OPN_RJCT,   ///< PeerLinkOpen_Reject
-    REQ_RJCT,   ///< PeerLinkOpenReject by internal reason
-    CNF_ACPT,   ///< PeerLinkConfirm_Accept
-    CNF_RJCT,   ///< PeerLinkConfirm_Reject
-    TOR1,       ///< Timeout of retry timer
-    TOR2,       ///< also timeout of retry timer
-    TOC,        ///< Timeout of confirm timer
-    TOH,        ///< Timeout of holding (gracefull closing) timer
-  };
-
-private:
-  /// State transition
-  void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED);
-
   /**
    * \name Event handlers
    * \{
@@ -201,7 +195,8 @@
   void RetryTimeout ();
   void ConfirmTimeout ();
   //\}
-
+  /// Several successive beacons were lost, close link
+  void BeaconLoss ();
 private:
   ///The number of interface I am associated with
   uint32_t m_interface;
@@ -255,10 +250,6 @@
   uint16_t m_maxBeaconLoss;
   uint16_t m_maxPacketFail;
   //\}
-
-  /// Several successive beacons were lost, close link
-  void BeaconLoss ();
-
   /// How to report my status change
   SignalStatusCallback m_linkStatusCallback;
 };
--- a/src/devices/mesh/dot11s/peer-management-protocol-mac.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.h	Wed Sep 02 14:58:36 2009 +0400
@@ -60,6 +60,29 @@
 private:
   friend class PeerManagementProtocol;
   friend class PeerLink;
+   ///\name Create peer link management frames:
+   ///\{
+  struct PlinkFrameStart
+  {
+    uint8_t subtype;
+    uint16_t aid;
+    SupportedRates rates;
+    uint16_t qos;
+  };
+  Ptr<Packet> CreatePeerLinkOpenFrame ();
+  Ptr<Packet> CreatePeerLinkConfirmFrame ();
+  Ptr<Packet> CreatePeerLinkCloseFrame ();
+  /**
+   * \brief This structure keeps all fields in peer link management frame,
+   * which are not subclasses of WifiInformationElement
+   */
+  /// \name Parses the start of the frame, where there are no
+  /// WifiInformationElements exist
+  PlinkFrameStart ParsePlinkFrame (Ptr<const Packet> packet);
+  ///\}
+  ///// Closes link when a proper number of successive transmissions have failed
+  void TxError (WifiMacHeader const &hdr);
+  void TxOk (WifiMacHeader const &hdr);
   ///\name BCA functionallity:
   ///\{
   ///\brief Fills TBTT and beacon interval. Needed by BCA
@@ -79,35 +102,9 @@
       );
   ///\brief DUBUG only - to print established links
   Mac48Address GetAddress () const;
-private:
-  ///\name Information about MAC and protocol:
-  ///\{
-  Ptr<MeshWifiInterfaceMac> m_parent;
-  uint32_t m_ifIndex;
-  Ptr<PeerManagementProtocol> m_protocol;
-   ///\}
-   ///\name Create peer link management frames:
-   ///\{
-  Ptr<Packet> CreatePeerLinkOpenFrame ();
-  Ptr<Packet> CreatePeerLinkConfirmFrame ();
-  Ptr<Packet> CreatePeerLinkCloseFrame ();
-  ///This structure keeps all fields in peer link management frame,
-  ///which are not subclasses of WifiInformationElement
-  struct PlinkFrameStart {
-    uint8_t subtype;
-    uint16_t aid;
-    SupportedRates rates;
-    uint16_t qos;
-  };
-  /// \name Parses the start of the frame, where there are no
-  /// WifiInformationElements exist
-  PlinkFrameStart ParsePlinkFrame (Ptr<const Packet> packet);
-  ///\}
-  ///// Closes link when a proper number of successive transmissions have failed
-  void TxError (WifiMacHeader const &hdr);
-  void TxOk (WifiMacHeader const &hdr);
-  //Keeps statistics
-  struct Statistics {
+  ///\name Statistics
+  struct Statistics
+  {
     uint16_t txOpen;
     uint16_t txConfirm;
     uint16_t txClose;
@@ -125,7 +122,15 @@
     Statistics ();
     void Print (std::ostream & os) const;
   };
+private:
   struct Statistics m_stats;
+  ///\}
+  ///\name Information about MAC and protocol:
+  ///\{
+  Ptr<MeshWifiInterfaceMac> m_parent;
+  uint32_t m_ifIndex;
+  Ptr<PeerManagementProtocol> m_protocol;
+   ///\}
 };
 
 } // namespace dot11s
--- a/src/devices/mesh/dot11s/peer-management-protocol.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-protocol.h	Wed Sep 02 14:58:36 2009 +0400
@@ -236,7 +236,8 @@
    */
   Callback <void, Mac48Address, Mac48Address, uint32_t, bool> m_peerStatusCallback;
   ///\}
-  //Keeps statistics
+  ///\name Statistics:
+  ///\{
   struct Statistics {
     uint16_t linksTotal;
     uint16_t linksOpened;
@@ -246,7 +247,7 @@
     void Print (std::ostream & os) const;
   };
   struct Statistics m_stats;
-
+  ///\}
 };
 
 } // namespace dot11s
--- a/src/devices/mesh/mesh-point-device.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/mesh-point-device.h	Wed Sep 02 14:58:36 2009 +0400
@@ -166,7 +166,8 @@
   /// Current routing protocol, used mainly by GetRoutingProtocol
   Ptr<MeshL2RoutingProtocol> m_routingProtocol;
 
-  /// Device statistics counters
+  ///\name Device statistics counters
+  ///\{
   struct Statistics
   {
     uint32_t unicastData;
@@ -178,6 +179,7 @@
   };
   /// Counters
   Statistics m_rxStats, m_txStats, m_fwdStats;
+  ///\}
 };
 } //namespace ns3
 #endif
--- a/src/devices/mesh/mesh-wifi-interface-mac.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.h	Wed Sep 02 14:58:36 2009 +0400
@@ -180,9 +180,10 @@
   virtual void DoDispose ();
 
 private:
+  typedef std::map<AccessClass, Ptr<DcaTxop> > Queues;
+  typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
   ///\name Wifi MAC internals
   //\{
-  typedef std::map<AccessClass, Ptr<DcaTxop> > Queues;
   Queues m_queues;
   Ptr<DcaTxop> m_beaconDca;
   Ptr<WifiRemoteStationManager> m_stationManager;
@@ -225,8 +226,6 @@
 
   /// "Timer" for the next beacon
   EventId m_beaconSendEvent;
-
-  typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
   /// List of all installed plugins
   PluginList m_plugins;
   Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > m_linkMetricCallback;
--- a/src/devices/mesh/wifi-information-element-vector.h	Tue Sep 01 23:35:36 2009 +0400
+++ b/src/devices/mesh/wifi-information-element-vector.h	Wed Sep 02 14:58:36 2009 +0400
@@ -143,8 +143,8 @@
   bool AddInformationElement (Ptr<WifiInformationElement> element);
   Ptr<WifiInformationElement> FindFirst (enum WifiElementId id) const;
 private:
+  typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
   uint32_t GetSize () const;
-  typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
   IE_VECTOR m_elements;
   /// Size in bytes (actually, max packet length)
   uint16_t m_maxSize;