Flame review
authorPavel Boyko <boyko@iitp.ru>
Mon, 22 Jun 2009 14:39:25 +0400
changeset 5095 9ee59991bbef
parent 5094 b98a7a92f020
child 5096 79c84012dac7
Flame review
src/devices/mesh/flame/flame-installer.h
src/devices/mesh/flame/flame-protocol.cc
src/devices/mesh/flame/flame-protocol.h
src/devices/mesh/flame/flame-rtable.h
--- a/src/devices/mesh/flame/flame-installer.h	Fri Jun 19 14:13:35 2009 +0400
+++ b/src/devices/mesh/flame/flame-installer.h	Mon Jun 22 14:39:25 2009 +0400
@@ -23,6 +23,11 @@
 #define FLAME_STACK_INSTALLER_H
 #include "ns3/mesh-stack-installer.h"
 namespace ns3 {
+/**
+ * \ingroup flame
+ * 
+ * \brief FLAME mesh stack (actually single protocol in this stack)
+ */
 class FlameStack : public MeshStack
 {
   public:
@@ -31,7 +36,7 @@
     ~FlameStack ();
     void DoDispose ();
 
-    ///\brief Installs 802.11s stack. needed by helper only
+    /// Installs flame stack on given mesh point device.
     bool InstallStack (Ptr<MeshPointDevice> mp);
     void Report (const Ptr<MeshPointDevice> mp, std::ostream&);
     void ResetStats (const Ptr<MeshPointDevice> mp);
--- a/src/devices/mesh/flame/flame-protocol.cc	Fri Jun 19 14:13:35 2009 +0400
+++ b/src/devices/mesh/flame/flame-protocol.cc	Mon Jun 22 14:39:25 2009 +0400
@@ -30,13 +30,14 @@
 #include "ns3/mesh-wifi-interface-mac.h"
 #include "ns3/random-variable.h"
 
+NS_LOG_COMPONENT_DEFINE ("FlameProtocol");
+
 namespace ns3 {
 namespace flame {
 //-----------------------------------------------------------------------------
 // FlameTag
 //-----------------------------------------------------------------------------
 NS_OBJECT_ENSURE_REGISTERED (FlameTag);
-NS_LOG_COMPONENT_DEFINE ("FlameProtocol");
 
 TypeId
 FlameTag::GetTypeId ()
@@ -92,7 +93,7 @@
 }
 
 //-----------------------------------------------------------------------------
-// FlameTag
+// FlameProtocol
 //-----------------------------------------------------------------------------
 TypeId
 FlameProtocol::GetTypeId ()
@@ -160,7 +161,7 @@
     tag.receiver = result.retransmitter;
     NS_LOG_DEBUG("Source: send packet with RA = " << tag.receiver);
     packet->AddPacketTag (tag);
-    routeReply (true, packet, source, destination, FLAME_PORT, result.ifIndex);
+    routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
   }
   else
   {
@@ -188,7 +189,7 @@
       flameHdr.AddCost (1);
       packet->AddHeader (flameHdr);
       packet->AddPacketTag (tag);
-      routeReply (true, packet, source, destination, FLAME_PORT, FlameRtable::INTERFACE_ANY);
+      routeReply (true, packet, source, destination, FLAME_PROTOCOL, FlameRtable::INTERFACE_ANY);
       return true;
     }
     else
@@ -210,7 +211,7 @@
       flameHdr.AddCost (1);
       packet->AddHeader (flameHdr);
       packet->AddPacketTag (tag);
-      routeReply (true, packet, source, destination, FLAME_PORT, result.ifIndex);
+      routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
       return true;
     }
     return true;
@@ -235,7 +236,7 @@
   //TODO: send path update
   FlameHeader flameHdr;
   packet->RemoveHeader (flameHdr);
-  NS_ASSERT(protocolType == FLAME_PORT);
+  NS_ASSERT(protocolType == FLAME_PROTOCOL);
   protocolType = flameHdr.GetProtocol ();
   return (!HandleDataFrame(flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface));
 }
--- a/src/devices/mesh/flame/flame-protocol.h	Fri Jun 19 14:13:35 2009 +0400
+++ b/src/devices/mesh/flame/flame-protocol.h	Mon Jun 22 14:39:25 2009 +0400
@@ -28,18 +28,27 @@
 #include "ns3/mesh-l2-routing-protocol.h"
 #include "ns3/tag.h"
 #include <map>
+
+/**
+ * \ingroup mesh
+ * \defgroup flame FLAME 
+ * 
+ * \brief Forwarding LAyer for Meshing protocol
+ * 
+ * TODO add relevant references
+ */
 namespace ns3 {
 namespace flame {
 /**
- * \brief Seqno and TTL tag
+ * \ingroup flame
+ * \brief Transmitter and receiver addresses
  */
-
 class FlameTag : public Tag
 {
 public:
-  //transmitter for incoming:
+  /// transmitter for incoming:
   Mac48Address  transmitter;
-  // Receiver of the packet:
+  /// Receiver of the packet:
   Mac48Address  receiver;
   
   FlameTag (Mac48Address a = Mac48Address ()) :
@@ -58,10 +67,8 @@
 
 /**
  * \ingroup flame
- * 
- * \brief FLAME = Forwarding Layer for Meshing
+ * \brief FLAME routing protocol
  */
-
 class FlameProtocol : public MeshL2RoutingProtocol
 {
 public:
@@ -82,41 +89,42 @@
    * Installing protocol cause installing its interface MAC plugins.
    *  
    * Also MP aggregates all installed protocols, FLAME protocol can be accessed 
-   * via MeshPointDevice::GetObject<dot11s::FlameProtocol>();
+   * via MeshPointDevice::GetObject<flame::FlameProtocol>();
    */
   bool Install (Ptr<MeshPointDevice>);
   Mac48Address GetAddress ();
-  ///\brief Statistics:
+  /// Statistics
   void Report (std::ostream &) const;
   void ResetStats ();
 private:
+  /// LLC protocol number reserved by flame
+  static const uint16_t FLAME_PROTOCOL = 0x4040;
   /**
-   * \brif Handles a packet: adds a routing information and drops
-   * packets by TTL or Seqno
-   * \returns true if packet shall be dropeed
+   * \brief Handles a packet: adds a routing information and drops packets by TTL or Seqno
+   * 
+   * \return true if packet shall be dropped
    */
   bool HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromIface);
-  static const uint16_t FLAME_PORT = 0x4040;
   /**
-   * \name Information about MeshPointDeviceaddress , plugins
+   * \name Information about MeshPointDeviceaddress, plugins
    * \{
    */
   typedef std::map<uint32_t, Ptr<FlameProtocolMac> > FlamePluginMap;
   FlamePluginMap m_interfaces;
   Mac48Address m_address;
-  ///\}
+  //\}
   /**
    * \name Broadcast timers:
    * \{
    */
   Time m_broadcastInterval;
   Time m_lastBroadcast;
-  ///\}
+  //\}
   /// Max Cost value (or TTL, because cost is actually hopcount)
   uint8_t m_maxCost;
   /// Sequence number:
   uint16_t m_myLastSeqno;
-  /// Routng table:
+  /// Routing table:
   Ptr<FlameRtable> m_rtable;
 };
 } //namespace flame
--- a/src/devices/mesh/flame/flame-rtable.h	Fri Jun 19 14:13:35 2009 +0400
+++ b/src/devices/mesh/flame/flame-rtable.h	Mon Jun 22 14:39:25 2009 +0400
@@ -69,8 +69,7 @@
   ~FlameRtable ();
   void DoDispose ();
   
-  ///\name Add/delete paths
-  //\{ 
+  /// Add path
   void AddPath (
     const Mac48Address destination,
     const Mac48Address retransmitter,
@@ -79,8 +78,8 @@
     const uint16_t seqnum
   );
   /**
-   * Lookup path to destination
-   * \returns Broadcast if not found
+   * \brief Lookup path to destination
+   * \return Broadcast if not found
    */
   LookupResult Lookup (Mac48Address destination);
 private:
@@ -93,7 +92,7 @@
     Time whenExpire;
     uint32_t seqnum;
   };
-  /// Lifetime parameter:
+  /// Lifetime parameter
   Time m_lifetime;
   /// List of routes
   std::map<Mac48Address, Route>  m_routes;