|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
25 #include "ns3/llc-snap-header.h"
27 #include "ns3/simulator.h"
28 #include "ns3/packet.h"
29 #include "ns3/mesh-point-device.h"
30 #include "ns3/wifi-net-device.h"
31 #include "ns3/mesh-wifi-interface-mac.h"
50 .SetGroupName (
"Mesh")
73 for (
int j = 0; j < 6; j++)
78 for (
int j = 0; j < 6; j++)
89 for (
int j = 0; j < 6; j++)
94 for (
int j = 0; j < 6; j++)
114 static TypeId tid =
TypeId (
"ns3::flame::FlameProtocol")
116 .SetGroupName (
"Mesh")
118 .AddAttribute (
"BroadcastInterval",
119 "How often we must send broadcast packets",
125 .AddAttribute (
"MaxCost",
126 "Cost threshold after which packet will be dropped",
130 MakeUintegerChecker<uint8_t> (3)
155 if (sourceIface ==
m_mp->GetIfIndex ())
161 NS_FATAL_ERROR (
"FLAME tag is not supposed to be received from upper layers");
274 NS_FATAL_ERROR (
"FLAME tag must exist when packet is coming to protocol");
299 std::vector<Ptr<NetDevice> >
interfaces = mp->GetInterfaces ();
316 mac->SetBeaconGeneration (
false);
317 mac->InstallPlugin (flameMac);
319 mp->SetRoutingProtocol (
this);
321 mp->AggregateObject (
this);
354 txUnicast (0), txBroadcast (0), txBytes (0), droppedTtl (0), totalDropped (0)
361 "txUnicast=\"" << txUnicast <<
"\" "
362 "txBroadcast=\"" << txBroadcast <<
"\" "
363 "txBytes=\"" << txBytes <<
"\" "
364 "droppedTtl=\"" << droppedTtl <<
"\" "
365 "totalDropped=\"" << totalDropped <<
"\"/>" << std::endl;
371 "address=\"" <<
m_address <<
"\"" << std::endl <<
373 "maxCost=\"" << (uint16_t)
m_maxCost <<
"\">" << std::endl;
377 plugin->second->Report (os);
379 os <<
"</Flame>" << std::endl;
387 plugin->second->ResetStats ();
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint16_t m_myLastSeqno
Sequence number:
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
bool Install(Ptr< MeshPointDevice > mp)
Install FLAME on given mesh point.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void Print(std::ostream &os) const
uint16_t txBroadcast
transmit broadcast
Mac48Address receiver
Receiver of the packet:
Route lookup result, return type of LookupXXX methods.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void AddHeader(const Header &header)
Add header to this packet.
static Time Now(void)
Return the current simulation virtual time.
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_maxCost
Max Cost value (or TTL, because cost is actually hopcount)
void Deserialize(TagBuffer i)
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.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Interface for L2 mesh routing protocol and mesh point communication.
void Print(std::ostream &os) const
Print function.
LookupResult Lookup(Mac48Address destination)
Lookup path to destination.
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static TypeId GetTypeId()
Get the type ID.
void Report(std::ostream &os) const
Statistics.
Hold together all Wifi-related objects.
static const uint32_t INTERFACE_ANY
Means all interfaces.
void ResetStats()
Reset statistics function.
Ptr< MeshPointDevice > m_mp
Host mesh point.
uint32_t txBytes
transmit bytes
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
static Mac48Address GetBroadcast(void)
uint16_t totalDropped
total dropped
FlamePluginMap m_interfaces
interfaces
uint16_t droppedTtl
dropped TTL
tag a set of bytes in a packet
static Mac48Address ConvertFrom(const Address &address)
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Statistics m_stats
statistics
uint16_t seqnum
sequence number
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Transmitter and receiver addresses.
static TypeId GetTypeId()
Get the type ID.
Mac48Address m_address
address
Mac48Address transmitter
transmitter for incoming:
uint32_t GetSerializedSize() const
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
uint32_t GetIfIndex(void) const override
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Time m_lastBroadcast
Max Cost value (or TTL, because cost is actually hopcount)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void Serialize(TagBuffer i) const
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
static const uint16_t FLAME_PROTOCOL
LLC protocol number reserved by flame.
uint16_t txUnicast
transmit unicast
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
AttributeValue implementation for Time.
Mac48Address retransmitter
retransmitter
bool RequestRoute(uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr< const Packet > packet, uint16_t protocolType, RouteReplyCallback routeReply)
Route request, inherited from MeshL2RoutingProtocol.
void AddPath(const Mac48Address destination, const Mac48Address retransmitter, const uint32_t interface, const uint8_t cost, const uint16_t seqnum)
Add path.
Mac48Address GetAddress()
Get address of this instance.
Hold an unsigned integer type.
Time m_broadcastInterval
Max Cost value (or TTL, because cost is actually hopcount)
void CopyTo(uint8_t buffer[6]) const
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
void DoDispose()
Destructor implementation.
void CopyFrom(const uint8_t buffer[6])
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
bool RemoveRoutingStuff(uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t &protocolType)
Cleanup flame headers!
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint32_t ifIndex
IF index.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< WifiMac > GetMac(void) const
Ptr< FlameRtable > m_rtable
Routing table:
Basic MAC of mesh point Wi-Fi interface.