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. More... | |
~HwmpProtocolMac () | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
bool | Receive (Ptr< Packet > packet, const WifiMacHeader &header) |
Process received frame. More... | |
void | SetParent (Ptr< MeshWifiInterfaceMac > parent) |
Each plugin must be installed on an interface to work. More... | |
void | UpdateBeacon (MeshWifiBeacon &beacon) const |
Update beacon before it will be formed and sent. More... | |
bool | UpdateOutcomingFrame (Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) |
Update frame before it will be forwarded down. More... | |
Public Member Functions inherited from ns3::MeshWifiInterfaceMacPlugin | |
virtual | ~MeshWifiInterfaceMacPlugin () |
This is for subclasses. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< MeshWifiInterfaceMacPlugin > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= ([[maybe_unused]] const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Private Member Functions | |
uint16_t | GetChannelId () const |
Get the channel ID. More... | |
uint32_t | GetLinkMetric (Mac48Address peerAddress) const |
bool | ReceiveAction (Ptr< Packet > packet, const WifiMacHeader &header) |
Receive action management frame. More... | |
bool | ReceiveData (Ptr< Packet > packet, const WifiMacHeader &header) |
Receive data frame. More... | |
void | Report (std::ostream &os) const |
Report statistics. More... | |
void | ResetStats () |
Reset statistics. More... | |
void | SendMyPerr () |
Send PERR function. More... | |
void | SendMyPreq () |
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue) More... | |
Interaction with HWMP: | |
void | SendPreq (IePreq preq) |
Send PREQ function. More... | |
void | SendPreqVector (std::vector< IePreq > preq) |
Send PREQ function for vector of PREQ. More... | |
void | SendPrep (IePrep prep, Mac48Address receiver) |
Send PREP function. More... | |
void | ForwardPerr (std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers) |
Forward a path error. More... | |
void | InitiatePerr (std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers) |
initiate my own path error More... | |
void | RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno) |
Request a destination. More... | |
Static Private Member Functions | |
static WifiActionHeader | GetWifiActionHeader () |
Private Attributes | |
uint32_t | m_ifIndex |
IF index. More... | |
Ptr< MeshWifiInterfaceMac > | m_parent |
parent More... | |
Ptr< HwmpProtocol > | m_protocol |
protocol More... | |
my PREQ and PREQ timer: | |
EventId | m_preqTimer |
Timer for PREQs. More... | |
std::vector< IePreq > | m_myPreq |
container of PREQs More... | |
PERR timer and stored path error | |
EventId | m_perrTimer |
PERR. More... | |
MyPerr | m_myPerr |
PERR. More... | |
Statistics | |
Statistics | m_stats |
statistics More... | |
Friends | |
class | HwmpProtocol |
allow HwmpProtocol class friend access More... | |
Interface MAC plugin for HWMP – 802.11s routing protocol.
Definition at line 43 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 41 of file hwmp-protocol-mac.cc.
References NS_LOG_FUNCTION.
ns3::dot11s::HwmpProtocolMac::~HwmpProtocolMac | ( | ) |
Definition at line 46 of file hwmp-protocol-mac.cc.
|
virtual |
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 497 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 332 of file hwmp-protocol-mac.cc.
References ns3::Packet::AddHeader(), ns3::WifiInformationElementVector::AddInformationElement(), first::address, ns3::Mac48Address::GetBroadcast(), ns3::Packet::GetSize(), 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 453 of file hwmp-protocol-mac.cc.
References m_parent.
|
private |
peerAddress | peer address |
Definition at line 448 of file hwmp-protocol-mac.cc.
References m_parent.
|
staticprivate |
Definition at line 219 of file hwmp-protocol-mac.cc.
References ns3::WifiActionHeader::MESH, ns3::WifiActionHeader::ActionValue::meshAction, 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 386 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().
|
virtual |
Process received frame.
packet | |
header |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 174 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 100 of file hwmp-protocol-mac.cc.
References ns3::WifiInformationElementVector::Begin(), ns3::WifiInformationElementVector::End(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiActionHeader::GetCategory(), ns3::Packet::GetSize(), 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::Packet::RemoveHeader(), 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 57 of file hwmp-protocol-mac.cc.
References ns3::Packet::AddPacketTag(), ns3::WifiMacHeader::GetAddr3(), ns3::WifiMacHeader::GetAddr4(), ns3::dot11s::MeshHeader::GetAddressExt(), ns3::Mac48Address::GetBroadcast(), ns3::dot11s::MeshHeader::GetMeshSeqno(), ns3::dot11s::MeshHeader::GetMeshTtl(), ns3::Packet::GetSize(), ns3::WifiMacHeader::IsData(), m_protocol, m_stats, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::PeekPacketTag(), ns3::Packet::RemoveHeader(), 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 482 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 266 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 490 of file hwmp-protocol-mac.cc.
References m_stats, and NS_LOG_FUNCTION.
|
private |
Send PERR function.
Definition at line 435 of file hwmp-protocol-mac.cc.
References ns3::dot11s::HwmpProtocolMac::MyPerr::destinations, ForwardPerr(), ns3::EventId::IsRunning(), m_myPerr, m_perrTimer, m_protocol, NS_LOG_FUNCTION, ns3::dot11s::HwmpProtocolMac::MyPerr::receivers, and ns3::Simulator::Schedule().
Referenced by InitiatePerr().
|
private |
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
Definition at line 290 of file hwmp-protocol-mac.cc.
References ns3::EventId::IsRunning(), m_myPreq, m_preqTimer, m_protocol, NS_ASSERT, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and SendPreqVector().
Referenced by RequestDestination().
|
private |
Send PREP function.
prep | the PREP information element |
receiver | the MAC address of the receiver |
Definition at line 308 of file hwmp-protocol-mac.cc.
References ns3::Packet::AddHeader(), ns3::WifiInformationElementVector::AddInformationElement(), ns3::Packet::GetSize(), 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 228 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 236 of file hwmp-protocol-mac.cc.
References ns3::Packet::AddHeader(), ns3::WifiInformationElementVector::AddInformationElement(), ns3::Packet::GetSize(), 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().
|
virtual |
Each plugin must be installed on an interface to work.
parent | the parent object |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 50 of file hwmp-protocol-mac.cc.
References m_parent, and NS_LOG_FUNCTION.
|
inlinevirtual |
Update beacon before it will be formed and sent.
beacon |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 60 of file hwmp-protocol-mac.h.
|
virtual |
Update frame before it will be forwarded down.
packet | |
header | |
from | |
to |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 194 of file hwmp-protocol-mac.cc.
References ns3::Packet::AddHeader(), ns3::dot11s::HwmpTag::GetAddress(), ns3::dot11s::HwmpTag::GetSeqno(), ns3::Packet::GetSize(), ns3::dot11s::HwmpTag::GetTtl(), ns3::WifiMacHeader::IsData(), m_stats, NS_FATAL_ERROR, NS_LOG_FUNCTION, ns3::Packet::RemovePacketTag(), 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 65 of file hwmp-protocol-mac.h.
|
private |
IF index.
Definition at line 133 of file hwmp-protocol-mac.h.
Referenced by ReceiveAction(), and SendPreqVector().
|
private |
PERR.
Definition at line 150 of file hwmp-protocol-mac.h.
Referenced by InitiatePerr(), and SendMyPerr().
|
private |
container of PREQs
Definition at line 139 of file hwmp-protocol-mac.h.
Referenced by RequestDestination(), and SendMyPreq().
|
private |
parent
Definition at line 132 of file hwmp-protocol-mac.h.
Referenced by ForwardPerr(), GetChannelId(), GetLinkMetric(), ReceiveAction(), Report(), SendPrep(), SendPreqVector(), and SetParent().
|
private |
|
private |
|
private |
protocol
Definition at line 134 of file hwmp-protocol-mac.h.
Referenced by AssignStreams(), ForwardPerr(), ReceiveAction(), ReceiveData(), RequestDestination(), SendMyPerr(), SendMyPreq(), SendPrep(), and SendPreqVector().
|
private |
statistics
Definition at line 183 of file hwmp-protocol-mac.h.
Referenced by ForwardPerr(), ReceiveAction(), ReceiveData(), Report(), ResetStats(), SendPrep(), SendPreqVector(), and UpdateOutcomingFrame().