FLAME routing protocol. More...
#include "flame-protocol.h"
Classes | |
struct | Statistics |
Statistics structure. More... | |
Public Member Functions | |
FlameProtocol () | |
FlameProtocol (const FlameProtocol &)=delete | |
~FlameProtocol () override | |
void | DoDispose () override |
Destructor implementation. More... | |
Mac48Address | GetAddress () |
Get address of this instance. More... | |
bool | Install (Ptr< MeshPointDevice > mp) |
Install FLAME on given mesh point. More... | |
FlameProtocol & | operator= (const FlameProtocol &)=delete |
bool | RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t &protocolType) override |
Cleanup flame headers! More... | |
void | Report (std::ostream &os) const |
Statistics. More... | |
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. More... | |
void | ResetStats () |
Reset statistics function. More... | |
Public Member Functions inherited from ns3::MeshL2RoutingProtocol | |
~MeshL2RoutingProtocol () override | |
virtual D-tor for subclasses More... | |
Ptr< MeshPointDevice > | GetMeshPoint () const |
Each mesh protocol must be installed on the mesh point to work. More... | |
void | SetMeshPoint (Ptr< MeshPointDevice > mp) |
Set host mesh point, analog of SetNode (...) methods for upper layer protocols. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::MeshL2RoutingProtocol | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
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. More... | |
Private Attributes | |
Broadcast timers: | |
Time | m_broadcastInterval |
Max Cost value (or TTL, because cost is actually hopcount) More... | |
Time | m_lastBroadcast |
Max Cost value (or TTL, because cost is actually hopcount) More... | |
uint8_t | m_maxCost |
Max Cost value (or TTL, because cost is actually hopcount) More... | |
uint16_t | m_myLastSeqno |
Sequence number: More... | |
Ptr< FlameRtable > | m_rtable |
Routing table: More... | |
Statistics | m_stats |
statistics More... | |
Static Private Attributes | |
static const uint16_t | FLAME_PROTOCOL = 0x4040 |
LLC protocol number reserved by flame. More... | |
Information about MeshPointDeviceaddress, plugins | |
typedef std::map< uint32_t, Ptr< FlameProtocolMac > > | FlamePluginMap |
interfaces More... | |
FlamePluginMap | m_interfaces |
interfaces More... | |
Mac48Address | m_address |
address More... | |
Additional Inherited Members | |
Public Types inherited from ns3::MeshL2RoutingProtocol | |
typedef Callback< void, bool, Ptr< Packet >, Mac48Address, Mac48Address, uint16_t, uint32_t > | RouteReplyCallback |
Callback to be invoked when route discovery procedure is completed. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Protected Attributes inherited from ns3::MeshL2RoutingProtocol | |
Ptr< MeshPointDevice > | m_mp |
Host mesh point. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
FLAME routing protocol.
Definition at line 91 of file flame-protocol.h.
|
private |
interfaces
Definition at line 187 of file flame-protocol.h.
ns3::flame::FlameProtocol::FlameProtocol | ( | ) |
Definition at line 131 of file flame-protocol.cc.
|
override |
Definition at line 141 of file flame-protocol.cc.
|
delete |
|
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 146 of file flame-protocol.cc.
References m_interfaces, ns3::MeshL2RoutingProtocol::m_mp, and m_rtable.
Mac48Address ns3::flame::FlameProtocol::GetAddress | ( | ) |
Get address of this instance.
Definition at line 354 of file flame-protocol.cc.
References m_address.
Referenced by HandleDataFrame(), RemoveRoutingStuff(), and RequestRoute().
|
static |
Get the type ID.
Definition at line 112 of file flame-protocol.cc.
References m_broadcastInterval, m_maxCost, ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), ns3::Seconds(), and ns3::TypeId::SetParent().
|
private |
Handles a packet: adds a routing information and drops packets by TTL or Seqno.
seqno | |
source | |
flameHdr | |
receiver | |
fromIface |
Definition at line 360 of file flame-protocol.cc.
References ns3::flame::FlameRtable::AddPath(), ns3::flame::FlameProtocol::Statistics::droppedTtl, GetAddress(), ns3::Mac48Address::GetBroadcast(), ns3::flame::FlameHeader::GetCost(), ns3::flame::FlameHeader::GetSeqno(), ns3::flame::FlameRtable::Lookup(), 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().
bool ns3::flame::FlameProtocol::Install | ( | Ptr< MeshPointDevice > | mp | ) |
Install FLAME on given mesh point.
mp | the MeshPointDevice |
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 323 of file flame-protocol.cc.
References ns3::Mac48Address::ConvertFrom(), ns3::WifiNetDevice::GetIfIndex(), ns3::WifiNetDevice::GetMac(), ns3::Object::GetObject(), first::interfaces, m_address, m_interfaces, ns3::MeshL2RoutingProtocol::m_mp, and third::mac.
|
delete |
|
overridevirtual |
Cleanup flame headers!
fromIface | the from interface |
source | the source address |
destination | the destination address |
packet | the packet |
protocolType | the protocol type |
Implements ns3::MeshL2RoutingProtocol.
Definition at line 284 of file flame-protocol.cc.
References 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::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::Seconds(), and ns3::flame::FlameTag::transmitter.
void ns3::flame::FlameProtocol::Report | ( | std::ostream & | os | ) | const |
os | the output stream |
Definition at line 417 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().
|
overridevirtual |
Route request, inherited from MeshL2RoutingProtocol.
sourceIface | the source interface |
source | the source address |
destination | the destination address |
packet | the packet to route |
protocolType | the protocol type |
routeReply | the route reply |
Implements ns3::MeshL2RoutingProtocol.
Definition at line 154 of file flame-protocol.cc.
References ns3::flame::FlameHeader::AddCost(), ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::Packet::Copy(), FLAME_PROTOCOL, GetAddress(), ns3::Mac48Address::GetBroadcast(), ns3::flame::FlameHeader::GetSeqno(), ns3::Packet::GetSize(), HandleDataFrame(), ns3::flame::FlameRtable::LookupResult::ifIndex, ns3::flame::FlameRtable::INTERFACE_ANY, ns3::flame::FlameRtable::Lookup(), m_broadcastInterval, m_lastBroadcast, ns3::MeshL2RoutingProtocol::m_mp, m_myLastSeqno, m_rtable, m_stats, ns3::Simulator::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, ns3::Packet::PeekPacketTag(), ns3::flame::FlameTag::receiver, ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::flame::FlameRtable::LookupResult::retransmitter, ns3::flame::FlameHeader::SetOrigDst(), ns3::flame::FlameHeader::SetOrigSrc(), ns3::flame::FlameHeader::SetProtocol(), ns3::flame::FlameHeader::SetSeqno(), ns3::flame::FlameProtocol::Statistics::totalDropped, ns3::flame::FlameTag::transmitter, ns3::flame::FlameProtocol::Statistics::txBroadcast, ns3::flame::FlameProtocol::Statistics::txBytes, and ns3::flame::FlameProtocol::Statistics::txUnicast.
void ns3::flame::FlameProtocol::ResetStats | ( | ) |
Reset statistics function.
Definition at line 433 of file flame-protocol.cc.
References m_interfaces, and m_stats.
|
staticprivate |
LLC protocol number reserved by flame.
Definition at line 167 of file flame-protocol.h.
Referenced by RemoveRoutingStuff(), and RequestRoute().
|
private |
address
Definition at line 189 of file flame-protocol.h.
Referenced by GetAddress(), Install(), and Report().
|
private |
Max Cost value (or TTL, because cost is actually hopcount)
Definition at line 195 of file flame-protocol.h.
Referenced by GetTypeId(), RemoveRoutingStuff(), Report(), and RequestRoute().
|
private |
interfaces
Definition at line 188 of file flame-protocol.h.
Referenced by DoDispose(), Install(), Report(), and ResetStats().
|
private |
Max Cost value (or TTL, because cost is actually hopcount)
Definition at line 196 of file flame-protocol.h.
Referenced by RemoveRoutingStuff(), and RequestRoute().
|
private |
Max Cost value (or TTL, because cost is actually hopcount)
Definition at line 199 of file flame-protocol.h.
Referenced by GetTypeId(), HandleDataFrame(), and Report().
|
private |
|
private |
Routing table:
Definition at line 203 of file flame-protocol.h.
Referenced by DoDispose(), HandleDataFrame(), and RequestRoute().
|
private |
statistics
Definition at line 222 of file flame-protocol.h.
Referenced by HandleDataFrame(), Report(), RequestRoute(), and ResetStats().