diff --git a/src/devices/mesh/flame/flame-installer.h b/src/devices/mesh/flame/flame-installer.h index 0afb6ec28..c13d39434 100644 --- a/src/devices/mesh/flame/flame-installer.h +++ b/src/devices/mesh/flame/flame-installer.h @@ -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 @@ class FlameStack : public MeshStack ~FlameStack (); void DoDispose (); - ///\brief Installs 802.11s stack. needed by helper only + /// Installs flame stack on given mesh point device. bool InstallStack (Ptr mp); void Report (const Ptr mp, std::ostream&); void ResetStats (const Ptr mp); diff --git a/src/devices/mesh/flame/flame-protocol.cc b/src/devices/mesh/flame/flame-protocol.cc index 132cd709b..85f053908 100644 --- a/src/devices/mesh/flame/flame-protocol.cc +++ b/src/devices/mesh/flame/flame-protocol.cc @@ -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::Print (std::ostream &os) const } //----------------------------------------------------------------------------- -// FlameTag +// FlameProtocol //----------------------------------------------------------------------------- TypeId FlameProtocol::GetTypeId () @@ -160,7 +161,7 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, c 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 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, c 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 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, c 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 @@ FlameProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source //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)); } diff --git a/src/devices/mesh/flame/flame-protocol.h b/src/devices/mesh/flame/flame-protocol.h index a3e3a7886..71d19a333 100644 --- a/src/devices/mesh/flame/flame-protocol.h +++ b/src/devices/mesh/flame/flame-protocol.h @@ -28,18 +28,27 @@ #include "ns3/mesh-l2-routing-protocol.h" #include "ns3/tag.h" #include + +/** + * \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 @@ public: /** * \ingroup flame - * - * \brief FLAME = Forwarding Layer for Meshing + * \brief FLAME routing protocol */ - class FlameProtocol : public MeshL2RoutingProtocol { public: @@ -82,41 +89,42 @@ public: * Installing protocol cause installing its interface MAC plugins. * * Also MP aggregates all installed protocols, FLAME protocol can be accessed - * via MeshPointDevice::GetObject(); + * via MeshPointDevice::GetObject(); */ bool Install (Ptr); 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 > 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 m_rtable; }; } //namespace flame diff --git a/src/devices/mesh/flame/flame-rtable.h b/src/devices/mesh/flame/flame-rtable.h index b75cdabb5..d42d82d93 100644 --- a/src/devices/mesh/flame/flame-rtable.h +++ b/src/devices/mesh/flame/flame-rtable.h @@ -69,8 +69,7 @@ public: ~FlameRtable (); void DoDispose (); - ///\name Add/delete paths - //\{ + /// Add path void AddPath ( const Mac48Address destination, const Mac48Address retransmitter, @@ -79,8 +78,8 @@ public: 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 @@ private: Time whenExpire; uint32_t seqnum; }; - /// Lifetime parameter: + /// Lifetime parameter Time m_lifetime; /// List of routes std::map m_routes;