21 #include "flame-protocol-mac.h"
22 #include "flame-protocol.h"
23 #include "flame-header.h"
28 FlameProtocolMac::FlameProtocolMac (uint32_t ifIndex, Ptr<FlameProtocol> protocol) :
29 m_protocol (protocol), m_ifIndex (ifIndex)
32 FlameProtocolMac::~FlameProtocolMac ()
46 if (!header.IsData ())
53 NS_FATAL_ERROR (
"FLAME tag is not supposed to be received by network");
59 m_stats.rxBroadcast++;
65 m_stats.rxBytes += packet->
GetSize ();
73 if (!header.IsData ())
85 m_stats.txBroadcast++;
91 m_stats.txBytes += packet->
GetSize ();
95 FlameProtocolMac::GetChannelId ()
const
97 return m_parent->GetFrequencyChannel ();
99 FlameProtocolMac::Statistics::Statistics () :
100 txUnicast (0), txBroadcast (0), txBytes (0), rxUnicast (0), rxBroadcast (0), rxBytes (0)
104 FlameProtocolMac::Statistics::Print (std::ostream &os)
const
107 "txUnicast=\"" << txUnicast <<
"\" "
108 "txBroadcast=\"" << txBroadcast <<
"\" "
109 "txBytes=\"" << txBytes <<
"\" "
110 "rxUnicast=\"" << rxUnicast <<
"\" "
111 "rxBroadcast=\"" << rxBroadcast <<
"\" "
112 "rxBytes=\"" << rxBytes <<
"\"/>" << std::endl;
117 os <<
"<FlameProtocolMac" << std::endl <<
118 "address =\"" << m_parent->GetAddress () <<
"\">" << std::endl;
120 os <<
"</FlameProtocolMac>" << std::endl;
124 FlameProtocolMac::ResetStats ()
126 m_stats = Statistics ();
smart pointer class similar to boost::intrusive_ptr
void AddPacketTag(const Tag &tag) const
void Report(std::ostream &) const
Report statistics.
#define NS_LOG_COMPONENT_DEFINE(name)
uint32_t GetSize(void) const
#define NS_FATAL_ERROR(msg)
fatal error handling
bool PeekPacketTag(Tag &tag) const
static Mac48Address GetBroadcast(void)
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
Update frame before it will be forwarded down.
bool RemovePacketTag(Tag &tag)
Mac48Address receiver
Receiver of the packet:
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Each plugin must be installed on interface to work.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Process received frame.
Transmitter and receiver addresses.
Mac48Address transmitter
transmitter for incoming: