21 #include "ns3/mesh-wifi-interface-mac.h"
22 #include "ns3/packet.h"
23 #include "ns3/simulator.h"
24 #include "ns3/nstime.h"
26 #include "ns3/mgt-headers.h"
42 m_ifIndex (ifIndex), m_protocol (protocol)
63 NS_FATAL_ERROR (
"HWMP tag is not supposed to be received by network");
73 switch (meshHdr.GetAddressExt ())
81 "6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
83 tag.
SetSeqno (meshHdr.GetMeshSeqno ());
84 tag.
SetTtl (meshHdr.GetMeshTtl ());
108 std::vector<HwmpProtocol::FailedDestination> failedDestinations;
120 if (preq->GetOriginatorAddress () ==
m_protocol->GetAddress ())
124 if (preq->GetTtl () == 0)
128 preq->DecrementTtl ();
137 if (prep->GetTtl () == 0)
141 prep->DecrementTtl ();
150 std::vector<HwmpProtocol::FailedDestination> destinations = perr->GetAddressUnitVector ();
151 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = destinations.begin (); i
152 != destinations.end (); i++)
154 failedDestinations.push_back (*i);
158 if (failedDestinations.size () > 0)
221 std::vector<IePreq> preq_vector;
222 preq_vector.push_back (preq);
230 for (std::vector<IePreq>::iterator i = preq.begin (); i != preq.end (); i++)
245 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
251 m_parent->SendManagementFrame (packet, hdr);
258 for (std::vector<IePreq>::iterator i =
m_myPreq.begin (); i !=
m_myPreq.end (); i++)
265 i->AddDestinationAddressElement (
m_protocol->GetDoFlag (),
m_protocol->GetRfFlag (), dst, dst_seqno);
318 m_parent->SendManagementFrame (packet, hdr);
328 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = failedDestinations.begin (); i
329 != failedDestinations.end (); i++)
331 if (!perr->IsFull ())
333 perr->AddAddressUnit (*i);
341 if (perr->GetNumOfDest () > 0)
343 elements.AddInformationElement (perr);
354 if (receivers.size () >=
m_protocol->GetUnicastPerrThreshold ())
360 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
371 m_parent->SendManagementFrame (packet, hdr);
381 std::vector<Mac48Address>::const_iterator end = receivers.end ();
382 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != end; i++)
384 bool should_add =
true;
385 for (std::vector<Mac48Address>::const_iterator j =
m_myPerr.
receivers.begin (); j
400 std::vector<HwmpProtocol::FailedDestination>::const_iterator end = failedDestinations.end ();
401 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = failedDestinations.begin (); i != end; i++)
403 bool should_add =
true;
404 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator j =
m_myPerr.
destinations.begin (); j
407 if (((*i).destination == (*j).destination) && ((*j).seqnum > (*i).seqnum))
436 return m_parent->GetLinkMetric (peerAddress);
441 return m_parent->GetFrequencyChannel ();
444 txPreq (0), rxPreq (0), txPrep (0), rxPrep (0), txPerr (0), rxPerr (0), txMgt (0), txMgtBytes (0),
445 rxMgt (0), rxMgtBytes (0), txData (0), txDataBytes (0), rxData (0), rxDataBytes (0)
452 "txPreq= \"" << txPreq <<
"\"" << std::endl <<
453 "txPrep=\"" << txPrep <<
"\"" << std::endl <<
454 "txPerr=\"" << txPerr <<
"\"" << std::endl <<
455 "rxPreq=\"" << rxPreq <<
"\"" << std::endl <<
456 "rxPrep=\"" << rxPrep <<
"\"" << std::endl <<
457 "rxPerr=\"" << rxPerr <<
"\"" << std::endl <<
458 "txMgt=\"" << txMgt <<
"\"" << std::endl <<
459 "txMgtBytes=\"" << txMgtBytes <<
"\"" << std::endl <<
460 "rxMgt=\"" << rxMgt <<
"\"" << std::endl <<
461 "rxMgtBytes=\"" << rxMgtBytes <<
"\"" << std::endl <<
462 "txData=\"" << txData <<
"\"" << std::endl <<
463 "txDataBytes=\"" << txDataBytes <<
"\"" << std::endl <<
464 "rxData=\"" << rxData <<
"\"" << std::endl <<
465 "rxDataBytes=\"" << rxDataBytes <<
"\"/>" << std::endl;
470 os <<
"<HwmpProtocolMac" << std::endl <<
471 "address =\"" <<
m_parent->GetAddress () <<
"\">" << std::endl;
473 os <<
"</HwmpProtocolMac>" << std::endl;
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
bool ReceiveAction(Ptr< Packet > packet, const WifiMacHeader &header)
Receive action management frame.
void SetPreqID(uint32_t id)
uint32_t GetLinkMetric(Mac48Address peerAddress) const
Smart pointer class similar to boost::intrusive_ptr.
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Update beacon is empty, because HWMP does not know anything about beacons.
void SendMyPreq()
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue) ...
Hwmp tag implements interaction between HWMP protocol and MeshWifiMac.
void SendPrep(IePrep prep, Mac48Address receiver)
Request a destination.
void RequestDestination(Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno)
Request a destination.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
See 7.3.2.97 of 802.11s draft 2.07.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
std::vector< IePreq > m_myPreq
#define NS_FATAL_ERROR(msg)
Fatal error handling.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
void SetLifetime(uint32_t lifetime)
void SendPreq(IePreq preq)
Request a destination.
Mac48Address GetAddress()
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
static WifiActionHeader GetWifiActionHeader()
See 7.3.2.96 of 802.11s draft 2.07.
Ptr< MeshWifiInterfaceMac > m_parent
static Mac48Address GetBroadcast(void)
std::vector< Mac48Address > receivers
void SetOriginatorAddress(Mac48Address originator_address)
HwmpProtocolMac(uint32_t, Ptr< HwmpProtocol >)
void SetOriginatorSeqNumber(uint32_t originator_seq_number)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Add a destination address unit: flags, destination and sequence number.
void Print(std::ostream &os) const
std::vector< HwmpProtocol::FailedDestination > destinations
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
Update beacon is empty, because HWMP does not know anything about beacons.
Ptr< HwmpProtocol > m_protocol
int64_t AssignStreams(int64_t stream)
Update beacon is empty, because HWMP does not know anything about beacons.
bool ReceiveData(Ptr< Packet > packet, const WifiMacHeader &header)
Receive data frame.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
void ForwardPerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
Request a destination.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Update beacon is empty, because HWMP does not know anything about beacons.
void Report(std::ostream &) const
Report statistics.
void InitiatePerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
Request a destination.
void SetSeqno(uint32_t seqno)
void SetHopcount(uint8_t hopcount)
void AddHeader(const Header &header)
Add header to this packet.
uint16_t GetChannelId() const