A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::flame::FlameProtocol Class Reference

FLAME routing protocol. More...

#include "flame-protocol.h"

+ Inheritance diagram for ns3::flame::FlameProtocol:
+ Collaboration diagram for ns3::flame::FlameProtocol:

Classes

struct  Statistics
 Statistics structure. More...
 

Public Member Functions

 FlameProtocol ()
 
 FlameProtocol (const FlameProtocol &)=delete
 
 ~FlameProtocol () override
 
void DoDispose () override
 Destructor implementation.
 
Mac48Address GetAddress ()
 Get address of this instance.
 
bool Install (Ptr< MeshPointDevice > mp)
 Install FLAME on given mesh point.
 
FlameProtocoloperator= (const FlameProtocol &)=delete
 
bool RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t &protocolType) override
 Cleanup flame headers!
 
void Report (std::ostream &os) const
 Statistics.
 
bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr< const Packet > packet, uint16_t protocolType, RouteReplyCallback routeReply) override
 Route request, inherited from MeshL2RoutingProtocol.
 
void ResetStats ()
 Reset statistics function.
 
- Public Member Functions inherited from ns3::MeshL2RoutingProtocol
 ~MeshL2RoutingProtocol () override
 virtual D-tor for subclasses
 
Ptr< MeshPointDeviceGetMeshPoint () const
 Each mesh protocol must be installed on the mesh point to work.
 
void SetMeshPoint (Ptr< MeshPointDevice > mp)
 Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::MeshL2RoutingProtocol
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Private Member Functions

bool HandleDataFrame (uint16_t seqno, Mac48Address source, const FlameHeader flameHdr, Mac48Address receiver, uint32_t fromIface)
 Handles a packet: adds a routing information and drops packets by TTL or Seqno.
 

Private Attributes

Broadcast timers:
Time m_broadcastInterval
 Max Cost value (or TTL, because cost is actually hopcount)
 
Time m_lastBroadcast
 Max Cost value (or TTL, because cost is actually hopcount)
 
uint8_t m_maxCost
 Max Cost value (or TTL, because cost is actually hopcount)
 
uint16_t m_myLastSeqno
 Sequence number:
 
Ptr< FlameRtablem_rtable
 Routing table:
 
Statistics m_stats
 statistics
 

Static Private Attributes

static const uint16_t FLAME_PROTOCOL = 0x4040
 LLC protocol number reserved by flame.
 

Information about MeshPointDeviceaddress, plugins

typedef std::map< uint32_t, Ptr< FlameProtocolMac > > FlamePluginMap
 interfaces
 
FlamePluginMap m_interfaces
 interfaces
 
Mac48Address m_address
 address
 

Additional Inherited Members

- Public Types inherited from ns3::MeshL2RoutingProtocol
typedef Callback< void, bool, Ptr< Packet >, Mac48Address, Mac48Address, uint16_t, uint32_tRouteReplyCallback
 Callback to be invoked when route discovery procedure is completed.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 
- Protected Attributes inherited from ns3::MeshL2RoutingProtocol
Ptr< MeshPointDevicem_mp
 Host mesh point.
 

Detailed Description

FLAME routing protocol.

Definition at line 80 of file flame-protocol.h.

Member Typedef Documentation

◆ FlamePluginMap

interfaces

Definition at line 176 of file flame-protocol.h.

Constructor & Destructor Documentation

◆ FlameProtocol() [1/2]

ns3::flame::FlameProtocol::FlameProtocol ( )

Definition at line 120 of file flame-protocol.cc.

◆ ~FlameProtocol()

ns3::flame::FlameProtocol::~FlameProtocol ( )
override

Definition at line 130 of file flame-protocol.cc.

◆ FlameProtocol() [2/2]

ns3::flame::FlameProtocol::FlameProtocol ( const FlameProtocol & )
delete

Member Function Documentation

◆ DoDispose()

void ns3::flame::FlameProtocol::DoDispose ( )
overridevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 135 of file flame-protocol.cc.

References m_interfaces, ns3::MeshL2RoutingProtocol::m_mp, and m_rtable.

◆ GetAddress()

Mac48Address ns3::flame::FlameProtocol::GetAddress ( )

Get address of this instance.

Returns
the MAC address

Definition at line 343 of file flame-protocol.cc.

References m_address.

Referenced by HandleDataFrame(), RemoveRoutingStuff(), and RequestRoute().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::flame::FlameProtocol::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 101 of file flame-protocol.cc.

References m_broadcastInterval, m_maxCost, ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), ns3::Seconds(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ HandleDataFrame()

bool ns3::flame::FlameProtocol::HandleDataFrame ( uint16_t seqno,
Mac48Address source,
const FlameHeader flameHdr,
Mac48Address receiver,
uint32_t fromIface )
private

Handles a packet: adds a routing information and drops packets by TTL or Seqno.

Parameters
seqno
source
flameHdr
receiver
fromIface
Returns
true if packet shall be dropped

Definition at line 349 of file flame-protocol.cc.

References ns3::flame::FlameProtocol::Statistics::droppedTtl, GetAddress(), ns3::Mac48Address::GetBroadcast(), ns3::flame::FlameHeader::GetCost(), ns3::flame::FlameHeader::GetSeqno(), m_maxCost, m_rtable, m_stats, ns3::flame::FlameRtable::LookupResult::retransmitter, ns3::flame::FlameRtable::LookupResult::seqnum, and ns3::flame::FlameProtocol::Statistics::totalDropped.

Referenced by RemoveRoutingStuff(), and RequestRoute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Install()

bool ns3::flame::FlameProtocol::Install ( Ptr< MeshPointDevice > mp)

Install FLAME on given mesh point.

Parameters
mpthe MeshPointDevice
Returns
true if successful

Installing protocol causes installation of its interface MAC plugins.

Also MP aggregates all installed protocols, FLAME protocol can be accessed via MeshPointDevice::GetObject<flame::FlameProtocol>();

Definition at line 312 of file flame-protocol.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::Create(), m_address, m_interfaces, and ns3::MeshL2RoutingProtocol::m_mp.

+ Here is the call graph for this function:

◆ operator=()

FlameProtocol & ns3::flame::FlameProtocol::operator= ( const FlameProtocol & )
delete

◆ RemoveRoutingStuff()

bool ns3::flame::FlameProtocol::RemoveRoutingStuff ( uint32_t fromIface,
const Mac48Address source,
const Mac48Address destination,
Ptr< Packet > packet,
uint16_t & protocolType )
overridevirtual

Cleanup flame headers!

Parameters
fromIfacethe from interface
sourcethe source address
destinationthe destination address
packetthe packet
protocolTypethe protocol type
Returns
if the route removed

Implements ns3::MeshL2RoutingProtocol.

Definition at line 273 of file flame-protocol.cc.

References ns3::Create(), FLAME_PROTOCOL, GetAddress(), ns3::Mac48Address::GetBroadcast(), ns3::flame::FlameHeader::GetProtocol(), ns3::flame::FlameHeader::GetSeqno(), HandleDataFrame(), m_broadcastInterval, m_lastBroadcast, ns3::MeshL2RoutingProtocol::m_mp, ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, ns3::Seconds(), and ns3::flame::FlameTag::transmitter.

+ Here is the call graph for this function:

◆ Report()

void ns3::flame::FlameProtocol::Report ( std::ostream & os) const

Statistics.

Parameters
osthe output stream

Definition at line 406 of file flame-protocol.cc.

References ns3::Time::GetSeconds(), m_address, m_broadcastInterval, m_interfaces, m_maxCost, m_stats, and ns3::flame::FlameProtocol::Statistics::Print().

+ Here is the call graph for this function:

◆ RequestRoute()

bool ns3::flame::FlameProtocol::RequestRoute ( uint32_t sourceIface,
const Mac48Address source,
const Mac48Address destination,
Ptr< const Packet > packet,
uint16_t protocolType,
RouteReplyCallback routeReply )
overridevirtual

◆ ResetStats()

void ns3::flame::FlameProtocol::ResetStats ( )

Reset statistics function.

Definition at line 422 of file flame-protocol.cc.

References m_interfaces, and m_stats.

Member Data Documentation

◆ FLAME_PROTOCOL

const uint16_t ns3::flame::FlameProtocol::FLAME_PROTOCOL = 0x4040
staticprivate

LLC protocol number reserved by flame.

Definition at line 156 of file flame-protocol.h.

Referenced by RemoveRoutingStuff(), and RequestRoute().

◆ m_address

Mac48Address ns3::flame::FlameProtocol::m_address
private

address

Definition at line 178 of file flame-protocol.h.

Referenced by GetAddress(), Install(), and Report().

◆ m_broadcastInterval

Time ns3::flame::FlameProtocol::m_broadcastInterval
private

Max Cost value (or TTL, because cost is actually hopcount)

Definition at line 184 of file flame-protocol.h.

Referenced by GetTypeId(), RemoveRoutingStuff(), Report(), and RequestRoute().

◆ m_interfaces

FlamePluginMap ns3::flame::FlameProtocol::m_interfaces
private

interfaces

Definition at line 177 of file flame-protocol.h.

Referenced by DoDispose(), Install(), Report(), and ResetStats().

◆ m_lastBroadcast

Time ns3::flame::FlameProtocol::m_lastBroadcast
private

Max Cost value (or TTL, because cost is actually hopcount)

Definition at line 185 of file flame-protocol.h.

Referenced by RemoveRoutingStuff(), and RequestRoute().

◆ m_maxCost

uint8_t ns3::flame::FlameProtocol::m_maxCost
private

Max Cost value (or TTL, because cost is actually hopcount)

Definition at line 188 of file flame-protocol.h.

Referenced by GetTypeId(), HandleDataFrame(), and Report().

◆ m_myLastSeqno

uint16_t ns3::flame::FlameProtocol::m_myLastSeqno
private

Sequence number:

Definition at line 190 of file flame-protocol.h.

Referenced by RequestRoute().

◆ m_rtable

Ptr<FlameRtable> ns3::flame::FlameProtocol::m_rtable
private

Routing table:

Definition at line 192 of file flame-protocol.h.

Referenced by DoDispose(), HandleDataFrame(), and RequestRoute().

◆ m_stats

Statistics ns3::flame::FlameProtocol::m_stats
private

statistics

Definition at line 211 of file flame-protocol.h.

Referenced by HandleDataFrame(), Report(), RequestRoute(), and ResetStats().


The documentation for this class was generated from the following files: