Interface MAC plugin for HWMP – 802.11s routing protocol. More...
#include "hwmp-protocol-mac.h"
Classes | |
struct | MyPerr |
MyPerr structure. More... | |
struct | Statistics |
Statistics structure. More... | |
Public Member Functions | |
HwmpProtocolMac (uint32_t ifIndex, Ptr< HwmpProtocol > protocol) | |
Constructor. | |
~HwmpProtocolMac () override | |
int64_t | AssignStreams (int64_t stream) override |
Assign a fixed random variable stream number to the random variables used by this model. | |
bool | Receive (Ptr< Packet > packet, const WifiMacHeader &header) override |
Process received frame. | |
void | SetParent (Ptr< MeshWifiInterfaceMac > parent) override |
Each plugin must be installed on an interface to work. | |
void | UpdateBeacon (MeshWifiBeacon &beacon) const override |
Update beacon before it will be formed and sent. | |
bool | UpdateOutcomingFrame (Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override |
Update frame before it will be forwarded down. | |
Public Member Functions inherited from ns3::MeshWifiInterfaceMacPlugin | |
virtual | ~MeshWifiInterfaceMacPlugin () |
This is for subclasses. | |
Public Member Functions inherited from ns3::SimpleRefCount< MeshWifiInterfaceMacPlugin > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Private Member Functions | |
uint16_t | GetChannelId () const |
Get the channel ID. | |
uint32_t | GetLinkMetric (Mac48Address peerAddress) const |
bool | ReceiveAction (Ptr< Packet > packet, const WifiMacHeader &header) |
Receive action management frame. | |
bool | ReceiveData (Ptr< Packet > packet, const WifiMacHeader &header) |
Receive data frame. | |
void | Report (std::ostream &os) const |
Report statistics. | |
void | ResetStats () |
Reset statistics. | |
void | SendMyPerr () |
Send PERR function. | |
void | SendMyPreq () |
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue) | |
Interaction with HWMP: | |
void | SendPreq (IePreq preq) |
Send PREQ function. | |
void | SendPreqVector (std::vector< IePreq > preq) |
Send PREQ function for vector of PREQ. | |
void | SendPrep (IePrep prep, Mac48Address receiver) |
Send PREP function. | |
void | ForwardPerr (std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers) |
Forward a path error. | |
void | InitiatePerr (std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers) |
initiate my own path error | |
void | RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno) |
Request a destination. | |
Static Private Member Functions | |
static WifiActionHeader | GetWifiActionHeader () |
Private Attributes | |
uint32_t | m_ifIndex |
IF index. | |
Ptr< MeshWifiInterfaceMac > | m_parent |
parent | |
Ptr< HwmpProtocol > | m_protocol |
protocol | |
my PREQ and PREQ timer: | |
EventId | m_preqTimer |
Timer for PREQs. | |
std::vector< IePreq > | m_myPreq |
container of PREQs | |
PERR timer and stored path error | |
EventId | m_perrTimer |
PERR. | |
MyPerr | m_myPerr |
PERR. | |
Statistics | |
Statistics | m_stats |
statistics | |
Friends | |
class | HwmpProtocol |
allow HwmpProtocol class friend access | |
Interface MAC plugin for HWMP – 802.11s routing protocol.
Definition at line 34 of file hwmp-protocol-mac.h.
ns3::dot11s::HwmpProtocolMac::HwmpProtocolMac | ( | uint32_t | ifIndex, |
Ptr< HwmpProtocol > | protocol ) |
Constructor.
ifIndex | interface index |
protocol | pointer to HWMP protocol instance |
Definition at line 34 of file hwmp-protocol-mac.cc.
References NS_LOG_FUNCTION.
|
override |
Definition at line 41 of file hwmp-protocol-mac.cc.
|
overridevirtual |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 537 of file hwmp-protocol-mac.cc.
References m_protocol.
|
private |
Forward a path error.
destinations | vector of failed destinations |
receivers | vector of receivers |
Definition at line 355 of file hwmp-protocol-mac.cc.
References ns3::MeshInformationElementVector::AddInformationElement(), ns3::Create(), ns3::Mac48Address::GetBroadcast(), GetWifiActionHeader(), m_parent, m_protocol, m_stats, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::WifiMacHeader::SetType(), ns3::dot11s::HwmpProtocolMac::Statistics::txMgt, ns3::dot11s::HwmpProtocolMac::Statistics::txMgtBytes, ns3::dot11s::HwmpProtocolMac::Statistics::txPerr, and ns3::WIFI_MAC_MGT_ACTION.
Referenced by ns3::dot11s::HwmpProtocol::ForwardPathError(), and SendMyPerr().
|
private |
Get the channel ID.
Definition at line 476 of file hwmp-protocol-mac.cc.
References m_parent.
|
private |
peerAddress | peer address |
Definition at line 470 of file hwmp-protocol-mac.cc.
References m_parent.
|
staticprivate |
Definition at line 229 of file hwmp-protocol-mac.cc.
References ns3::WifiActionHeader::MESH, ns3::WifiActionHeader::PATH_SELECTION, and ns3::WifiActionHeader::SetAction().
Referenced by ForwardPerr(), SendPrep(), and SendPreqVector().
|
private |
initiate my own path error
destinations | vector of failed destinations |
receivers | vector of receivers |
Definition at line 409 of file hwmp-protocol-mac.cc.
References ns3::dot11s::HwmpProtocolMac::MyPerr::destinations, m_myPerr, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::dot11s::HwmpProtocolMac::MyPerr::receivers, and SendMyPerr().
|
overridevirtual |
Process received frame.
packet | |
header |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 180 of file hwmp-protocol-mac.cc.
References ns3::WifiMacHeader::IsAction(), ns3::WifiMacHeader::IsData(), NS_LOG_FUNCTION, ReceiveAction(), and ReceiveData().
|
private |
Receive action management frame.
packet | |
header |
Definition at line 97 of file hwmp-protocol-mac.cc.
References ns3::MeshInformationElementVector::Begin(), ns3::DynamicCast(), ns3::MeshInformationElementVector::End(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiActionHeader::GetCategory(), IE_PERR, IE_PREP, IE_PREQ, IE_RANN, m_ifIndex, m_parent, m_protocol, m_stats, ns3::WifiActionHeader::MESH, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_WARN, ns3::dot11s::HwmpProtocolMac::Statistics::rxMgt, ns3::dot11s::HwmpProtocolMac::Statistics::rxMgtBytes, ns3::dot11s::HwmpProtocolMac::Statistics::rxPerr, ns3::dot11s::HwmpProtocolMac::Statistics::rxPrep, and ns3::dot11s::HwmpProtocolMac::Statistics::rxPreq.
Referenced by Receive().
|
private |
Receive data frame.
packet | |
header |
Definition at line 53 of file hwmp-protocol-mac.cc.
References ns3::WifiMacHeader::GetAddr3(), ns3::WifiMacHeader::GetAddr4(), ns3::dot11s::MeshHeader::GetAddressExt(), ns3::Mac48Address::GetBroadcast(), ns3::dot11s::MeshHeader::GetMeshSeqno(), ns3::dot11s::MeshHeader::GetMeshTtl(), ns3::WifiMacHeader::IsData(), m_protocol, m_stats, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::dot11s::HwmpProtocolMac::Statistics::rxData, ns3::dot11s::HwmpProtocolMac::Statistics::rxDataBytes, ns3::dot11s::HwmpTag::SetSeqno(), and ns3::dot11s::HwmpTag::SetTtl().
Referenced by Receive().
|
private |
Report statistics.
os | The output stream on which to report |
Definition at line 521 of file hwmp-protocol-mac.cc.
References m_parent, m_stats, and ns3::dot11s::HwmpProtocolMac::Statistics::Print().
|
private |
Request a destination.
If cannot send PREQ immediately, add a destination to existing PREQ generated by me and stored in PREQ queue
dest | is the destination to be resolved |
originator_seqno | is a sequence number that shall be preq originator sequenece number |
dst_seqno | is a sequence number taken from routing table |
Definition at line 279 of file hwmp-protocol-mac.cc.
References ns3::dot11s::IePreq::AddDestinationAddressElement(), m_myPreq, m_protocol, NS_ASSERT, NS_LOG_FUNCTION, SendMyPreq(), ns3::dot11s::IePreq::SetHopcount(), ns3::dot11s::IePreq::SetLifetime(), ns3::dot11s::IePreq::SetOriginatorAddress(), ns3::dot11s::IePreq::SetOriginatorSeqNumber(), ns3::dot11s::IePreq::SetPreqID(), and ns3::dot11s::IePreq::SetTTL().
|
private |
Reset statistics.
Definition at line 530 of file hwmp-protocol-mac.cc.
References m_stats, and NS_LOG_FUNCTION.
|
private |
Send PERR function.
Definition at line 455 of file hwmp-protocol-mac.cc.
References ns3::dot11s::HwmpProtocolMac::MyPerr::destinations, ForwardPerr(), ns3::EventId::IsPending(), m_myPerr, m_perrTimer, m_protocol, NS_LOG_FUNCTION, ns3::dot11s::HwmpProtocolMac::MyPerr::receivers, ns3::Simulator::Schedule(), and SendMyPerr().
Referenced by InitiatePerr(), and SendMyPerr().
|
private |
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
Definition at line 310 of file hwmp-protocol-mac.cc.
References ns3::EventId::IsPending(), m_myPreq, m_preqTimer, m_protocol, NS_ASSERT, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), SendMyPreq(), and SendPreqVector().
Referenced by RequestDestination(), and SendMyPreq().
|
private |
Send PREP function.
prep | the PREP information element |
receiver | the MAC address of the receiver |
Definition at line 330 of file hwmp-protocol-mac.cc.
References ns3::MeshInformationElementVector::AddInformationElement(), ns3::Create(), GetWifiActionHeader(), m_parent, m_protocol, m_stats, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::WifiMacHeader::SetType(), ns3::dot11s::HwmpProtocolMac::Statistics::txMgt, ns3::dot11s::HwmpProtocolMac::Statistics::txMgtBytes, ns3::dot11s::HwmpProtocolMac::Statistics::txPrep, and ns3::WIFI_MAC_MGT_ACTION.
Referenced by ns3::dot11s::HwmpProtocol::ReceivePrep().
|
private |
Send PREQ function.
preq | the PREQ |
Definition at line 239 of file hwmp-protocol-mac.cc.
References NS_LOG_FUNCTION, and SendPreqVector().
Referenced by ns3::dot11s::HwmpProtocol::ReceivePreq().
|
private |
Send PREQ function for vector of PREQ.
preq | vector of PREQ information elements |
Definition at line 248 of file hwmp-protocol-mac.cc.
References ns3::MeshInformationElementVector::AddInformationElement(), ns3::Create(), GetWifiActionHeader(), m_ifIndex, m_parent, m_protocol, m_stats, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::WifiMacHeader::SetType(), ns3::dot11s::HwmpProtocolMac::Statistics::txMgt, ns3::dot11s::HwmpProtocolMac::Statistics::txMgtBytes, ns3::dot11s::HwmpProtocolMac::Statistics::txPreq, and ns3::WIFI_MAC_MGT_ACTION.
Referenced by SendMyPreq(), and SendPreq().
|
overridevirtual |
Each plugin must be installed on an interface to work.
parent | the parent object |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 46 of file hwmp-protocol-mac.cc.
References m_parent, and NS_LOG_FUNCTION.
|
inlineoverridevirtual |
Update beacon before it will be formed and sent.
beacon |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 55 of file hwmp-protocol-mac.h.
|
overridevirtual |
Update frame before it will be forwarded down.
packet | |
header | |
from | |
to |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 201 of file hwmp-protocol-mac.cc.
References ns3::dot11s::HwmpTag::GetAddress(), ns3::dot11s::HwmpTag::GetSeqno(), ns3::dot11s::HwmpTag::GetTtl(), ns3::WifiMacHeader::IsData(), m_stats, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr1(), ns3::dot11s::MeshHeader::SetMeshSeqno(), ns3::dot11s::MeshHeader::SetMeshTtl(), ns3::WifiMacHeader::SetQosMeshControlPresent(), ns3::dot11s::HwmpProtocolMac::Statistics::txData, and ns3::dot11s::HwmpProtocolMac::Statistics::txDataBytes.
|
friend |
allow HwmpProtocol class friend access
Definition at line 63 of file hwmp-protocol-mac.h.
|
private |
IF index.
Definition at line 135 of file hwmp-protocol-mac.h.
Referenced by ReceiveAction(), and SendPreqVector().
|
private |
PERR.
Definition at line 155 of file hwmp-protocol-mac.h.
Referenced by InitiatePerr(), and SendMyPerr().
|
private |
container of PREQs
Definition at line 141 of file hwmp-protocol-mac.h.
Referenced by RequestDestination(), and SendMyPreq().
|
private |
parent
Definition at line 134 of file hwmp-protocol-mac.h.
Referenced by ForwardPerr(), GetChannelId(), GetLinkMetric(), ReceiveAction(), Report(), SendPrep(), SendPreqVector(), and SetParent().
|
private |
|
private |
|
private |
protocol
Definition at line 136 of file hwmp-protocol-mac.h.
Referenced by AssignStreams(), ForwardPerr(), ReceiveAction(), ReceiveData(), RequestDestination(), SendMyPerr(), SendMyPreq(), SendPrep(), and SendPreqVector().
|
private |
statistics
Definition at line 189 of file hwmp-protocol-mac.h.
Referenced by ForwardPerr(), ReceiveAction(), ReceiveData(), Report(), ResetStats(), SendPrep(), SendPreqVector(), and UpdateOutcomingFrame().