|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/mesh-wifi-interface-mac.h"
22 #include "ns3/packet.h"
23 #include "ns3/simulator.h"
24 #include "ns3/nstime.h"
41 m_ifIndex (ifIndex), m_protocol (protocol)
65 NS_FATAL_ERROR (
"HWMP tag is not supposed to be received by network");
83 "6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
113 std::vector<HwmpProtocol::FailedDestination> failedDestinations;
116 if ((*i)->ElementId () ==
IE_RANN)
120 if ((*i)->ElementId () ==
IE_PREQ)
125 if (preq->GetOriginatorAddress () ==
m_protocol->GetAddress ())
129 if (preq->GetTtl () == 0)
133 preq->DecrementTtl ();
137 if ((*i)->ElementId () ==
IE_PREP)
142 if (prep->GetTtl () == 0)
146 prep->DecrementTtl ();
150 if ((*i)->ElementId () ==
IE_PERR)
155 std::vector<HwmpProtocol::FailedDestination> destinations = perr->GetAddressUnitVector ();
156 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = destinations.begin (); i
157 != destinations.end (); i++)
159 failedDestinations.push_back (*i);
163 if (failedDestinations.size () > 0)
229 std::vector<IePreq> preq_vector;
230 preq_vector.push_back (preq);
239 for (std::vector<IePreq>::iterator i = preq.begin (); i != preq.end (); i++)
254 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
260 m_parent->SendManagementFrame (packet, hdr);
267 for (std::vector<IePreq>::iterator i =
m_myPreq.begin (); i !=
m_myPreq.end (); i++)
274 i->AddDestinationAddressElement (
m_protocol->GetDoFlag (),
m_protocol->GetRfFlag (), dst, dst_seqno);
327 m_parent->SendManagementFrame (packet, hdr);
337 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = failedDestinations.begin (); i
338 != failedDestinations.end (); i++)
340 if (!perr->IsFull ())
342 perr->AddAddressUnit (*i);
350 if (perr->GetNumOfDest () > 0)
363 if (receivers.size () >=
m_protocol->GetUnicastPerrThreshold ())
369 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != receivers.end (); i++)
380 m_parent->SendManagementFrame (packet, hdr);
391 std::vector<Mac48Address>::const_iterator end = receivers.end ();
392 for (std::vector<Mac48Address>::const_iterator i = receivers.begin (); i != end; i++)
394 bool should_add =
true;
395 for (std::vector<Mac48Address>::const_iterator j =
m_myPerr.
receivers.begin (); j
406 NS_LOG_DEBUG (
"Initiate PERR: Adding receiver: " << (*i));
411 std::vector<HwmpProtocol::FailedDestination>::const_iterator end = failedDestinations.end ();
412 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator i = failedDestinations.begin (); i != end; i++)
414 bool should_add =
true;
415 for (std::vector<HwmpProtocol::FailedDestination>::const_iterator j =
m_myPerr.
destinations.begin (); j
418 if (((*i).destination == (*j).destination) && ((*j).seqnum > (*i).seqnum))
426 NS_LOG_DEBUG (
"Initiate PERR: Adding failed destination: " << (*i).destination);
448 return m_parent->GetLinkMetric (peerAddress);
453 return m_parent->GetFrequencyChannel ();
456 txPreq (0), rxPreq (0), txPrep (0), rxPrep (0), txPerr (0), rxPerr (0), txMgt (0), txMgtBytes (0),
457 rxMgt (0), rxMgtBytes (0), txData (0), txDataBytes (0), rxData (0), rxDataBytes (0)
464 "txPreq= \"" << txPreq <<
"\"" << std::endl <<
465 "txPrep=\"" << txPrep <<
"\"" << std::endl <<
466 "txPerr=\"" << txPerr <<
"\"" << std::endl <<
467 "rxPreq=\"" << rxPreq <<
"\"" << std::endl <<
468 "rxPrep=\"" << rxPrep <<
"\"" << std::endl <<
469 "rxPerr=\"" << rxPerr <<
"\"" << std::endl <<
470 "txMgt=\"" << txMgt <<
"\"" << std::endl <<
471 "txMgtBytes=\"" << txMgtBytes <<
"\"" << std::endl <<
472 "rxMgt=\"" << rxMgt <<
"\"" << std::endl <<
473 "rxMgtBytes=\"" << rxMgtBytes <<
"\"" << std::endl <<
474 "txData=\"" << txData <<
"\"" << std::endl <<
475 "txDataBytes=\"" << txDataBytes <<
"\"" << std::endl <<
476 "rxData=\"" << rxData <<
"\"" << std::endl <<
477 "rxDataBytes=\"" << rxDataBytes <<
"\"/>" << std::endl;
482 os <<
"<HwmpProtocolMac" << std::endl <<
483 "address =\"" <<
m_parent->GetAddress () <<
"\">" << std::endl;
485 os <<
"</HwmpProtocolMac>" << std::endl;
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint16_t GetChannelId() const
Get the channel ID.
uint32_t m_ifIndex
IF index.
void AddDestinationAddressElement(bool doFlag, bool rfFlag, Mac48Address dest_address, uint32_t dest_seq_number)
Add a destination address unit: flags, destination and sequence number.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void SendMyPreq()
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
bool ReceiveData(Ptr< Packet > packet, const WifiMacHeader &header)
Receive data frame.
uint32_t GetLinkMetric(Mac48Address peerAddress) const
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetSeqno()
Get the sequence number.
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Each plugin must be installed on an interface to work.
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
Update frame before it will be forwarded down.
bool ReceiveAction(Ptr< Packet > packet, const WifiMacHeader &header)
Receive action management frame.
uint16_t rxMgt
receive management
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
void SetTTL(uint8_t ttl)
Set remaining number of hops allowed for this element.
void SendMyPerr()
Send PERR function.
void SetSeqno(uint32_t seqno)
Set sequence number.
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
uint16_t rxPreq
receive PREQ
uint16_t txMgt
transmit management
void InitiatePerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
initiate my own path error
uint16_t rxPrep
receive PREP
void Print(std::ostream &os) const
Print function.
void ForwardPerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
Forward a path error.
void SetTtl(uint8_t ttl)
Set the TTL value.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
static Mac48Address GetBroadcast(void)
void SetOriginatorAddress(Mac48Address originator_address)
Set originator address value.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
uint32_t rxMgtBytes
receive management bytes
See 7.3.2.96 of 802.11s draft 2.07.
void RequestDestination(Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno)
Request a destination.
void ResetStats()
Reset statistics.
void SendPreq(IePreq preq)
Send PREQ function.
uint8_t GetTtl()
Get the TTL value.
void SetLifetime(uint32_t lifetime)
Set lifetime in TUs for the forwarding information to be considered valid.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Ptr< HwmpProtocol > m_protocol
protocol
std::vector< HwmpProtocol::FailedDestination > destinations
destinations
Mac48Address GetAddress()
Get address from tag.
std::vector< Mac48Address > receivers
receivers
uint16_t rxData
receive data
void AddPacketTag(const Tag &tag) const
Add a packet tag.
void SendPrep(IePrep prep, Mac48Address receiver)
Send PREP function.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Process received frame.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< MeshWifiInterfaceMac > m_parent
parent
void SetPreqID(uint32_t id)
Set path discovery id field.
uint16_t txData
transmit data
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
EventId m_preqTimer
Timer for PREQs.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
std::vector< IePreq > m_myPreq
container of PREQs
void SetOriginatorSeqNumber(uint32_t originator_seq_number)
Set originator sequence number.
See 7.3.2.97 of 802.11s draft 2.07.
uint16_t txPrep
transmit PREP
uint32_t txMgtBytes
transmit management bytes
void SetHopcount(uint8_t hopcount)
Set number of hops from originator to mesh STA transmitting this element.
Hwmp tag implements interaction between HWMP protocol and MeshWifiMac.
uint32_t txDataBytes
transmit data bytes
static WifiActionHeader GetWifiActionHeader()
void Report(std::ostream &os) const
Report statistics.
HwmpProtocolMac(uint32_t ifIndex, Ptr< HwmpProtocol > protocol)
Constructor.
uint16_t txPerr
transmit PERR
uint32_t rxDataBytes
receive data bytes
Statistics m_stats
statistics
uint16_t txPreq
transmit PREQ
uint16_t rxPerr
receive PERR