A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::dot11s::HwmpProtocolMac Class Reference

Interface MAC plugin for HWMP – 802.11s routing protocol. More...

#include "hwmp-protocol-mac.h"

+ Inheritance diagram for ns3::dot11s::HwmpProtocolMac:
+ Collaboration diagram for ns3::dot11s::HwmpProtocolMac:

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.
 
SimpleRefCountoperator= (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< MeshWifiInterfaceMacm_parent
 parent
 
Ptr< HwmpProtocolm_protocol
 protocol
 
my PREQ and PREQ timer:
EventId m_preqTimer
 Timer for PREQs.
 
std::vector< IePreqm_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
 

Detailed Description

Interface MAC plugin for HWMP – 802.11s routing protocol.

Definition at line 34 of file hwmp-protocol-mac.h.

Constructor & Destructor Documentation

◆ HwmpProtocolMac()

ns3::dot11s::HwmpProtocolMac::HwmpProtocolMac ( uint32_t ifIndex,
Ptr< HwmpProtocol > protocol )

Constructor.

Parameters
ifIndexinterface index
protocolpointer to HWMP protocol instance

Definition at line 34 of file hwmp-protocol-mac.cc.

References NS_LOG_FUNCTION.

◆ ~HwmpProtocolMac()

ns3::dot11s::HwmpProtocolMac::~HwmpProtocolMac ( )
override

Definition at line 41 of file hwmp-protocol-mac.cc.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::dot11s::HwmpProtocolMac::AssignStreams ( int64_t stream)
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.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 537 of file hwmp-protocol-mac.cc.

References m_protocol.

◆ ForwardPerr()

void ns3::dot11s::HwmpProtocolMac::ForwardPerr ( std::vector< HwmpProtocol::FailedDestination > destinations,
std::vector< Mac48Address > receivers )
private

Forward a path error.

Parameters
destinationsvector of failed destinations
receiversvector 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetChannelId()

uint16_t ns3::dot11s::HwmpProtocolMac::GetChannelId ( ) const
private

Get the channel ID.

Returns
the channel ID

Definition at line 476 of file hwmp-protocol-mac.cc.

References m_parent.

◆ GetLinkMetric()

uint32_t ns3::dot11s::HwmpProtocolMac::GetLinkMetric ( Mac48Address peerAddress) const
private
Parameters
peerAddresspeer address
Returns
metric to HWMP protocol, needed only by metrics to add peer as routing entry

Definition at line 470 of file hwmp-protocol-mac.cc.

References m_parent.

◆ GetWifiActionHeader()

WifiActionHeader ns3::dot11s::HwmpProtocolMac::GetWifiActionHeader ( )
staticprivate
Returns
a path selection action header

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitiatePerr()

void ns3::dot11s::HwmpProtocolMac::InitiatePerr ( std::vector< HwmpProtocol::FailedDestination > destinations,
std::vector< Mac48Address > receivers )
private

initiate my own path error

Parameters
destinationsvector of failed destinations
receiversvector 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().

+ Here is the call graph for this function:

◆ Receive()

bool ns3::dot11s::HwmpProtocolMac::Receive ( Ptr< Packet > packet,
const WifiMacHeader & header )
overridevirtual

Process received frame.

Parameters
packet
header
Returns
false if (and only if) frame should be dropped
Todo
define when MAC call this

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().

+ Here is the call graph for this function:

◆ ReceiveAction()

bool ns3::dot11s::HwmpProtocolMac::ReceiveAction ( Ptr< Packet > packet,
const WifiMacHeader & header )
private

Receive action management frame.

Parameters
packet
header
Returns
true if a packet was received

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReceiveData()

bool ns3::dot11s::HwmpProtocolMac::ReceiveData ( Ptr< Packet > packet,
const WifiMacHeader & header )
private

Receive data frame.

Parameters
packet
header
Returns
true if a packet was received
Todo
address extension

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Report()

void ns3::dot11s::HwmpProtocolMac::Report ( std::ostream & os) const
private

Report statistics.

Parameters
osThe 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().

+ Here is the call graph for this function:

◆ RequestDestination()

void ns3::dot11s::HwmpProtocolMac::RequestDestination ( Mac48Address dest,
uint32_t originator_seqno,
uint32_t dst_seqno )
private

Request a destination.

If cannot send PREQ immediately, add a destination to existing PREQ generated by me and stored in PREQ queue

Parameters
destis the destination to be resolved
originator_seqnois a sequence number that shall be preq originator sequenece number
dst_seqnois 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().

+ Here is the call graph for this function:

◆ ResetStats()

void ns3::dot11s::HwmpProtocolMac::ResetStats ( )
private

Reset statistics.

Definition at line 530 of file hwmp-protocol-mac.cc.

References m_stats, and NS_LOG_FUNCTION.

◆ SendMyPerr()

void ns3::dot11s::HwmpProtocolMac::SendMyPerr ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendMyPreq()

void ns3::dot11s::HwmpProtocolMac::SendMyPreq ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPrep()

void ns3::dot11s::HwmpProtocolMac::SendPrep ( IePrep prep,
Mac48Address receiver )
private

Send PREP function.

Parameters
prepthe PREP information element
receiverthe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPreq()

void ns3::dot11s::HwmpProtocolMac::SendPreq ( IePreq preq)
private

Send PREQ function.

Parameters
preqthe PREQ

Definition at line 239 of file hwmp-protocol-mac.cc.

References NS_LOG_FUNCTION, and SendPreqVector().

Referenced by ns3::dot11s::HwmpProtocol::ReceivePreq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPreqVector()

void ns3::dot11s::HwmpProtocolMac::SendPreqVector ( std::vector< IePreq > preq)
private

Send PREQ function for vector of PREQ.

Parameters
preqvector 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetParent()

void ns3::dot11s::HwmpProtocolMac::SetParent ( Ptr< MeshWifiInterfaceMac > parent)
overridevirtual

Each plugin must be installed on an interface to work.

Parameters
parentthe parent object

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 46 of file hwmp-protocol-mac.cc.

References m_parent, and NS_LOG_FUNCTION.

◆ UpdateBeacon()

void ns3::dot11s::HwmpProtocolMac::UpdateBeacon ( MeshWifiBeacon & beacon) const
inlineoverridevirtual

Update beacon before it will be formed and sent.

Parameters
beacon
Todo
define when MAC call this

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 54 of file hwmp-protocol-mac.h.

◆ UpdateOutcomingFrame()

bool ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame ( Ptr< Packet > packet,
WifiMacHeader & header,
Mac48Address from,
Mac48Address to )
overridevirtual

Update frame before it will be forwarded down.

Parameters
packet
header
from
to
Returns
false if (and only if) frame should be dropped
Todo
define when MAC call this, preconditions & postconditions

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.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ HwmpProtocol

friend class HwmpProtocol
friend

allow HwmpProtocol class friend access

Definition at line 59 of file hwmp-protocol-mac.h.

Member Data Documentation

◆ m_ifIndex

uint32_t ns3::dot11s::HwmpProtocolMac::m_ifIndex
private

IF index.

Definition at line 131 of file hwmp-protocol-mac.h.

Referenced by ReceiveAction(), and SendPreqVector().

◆ m_myPerr

MyPerr ns3::dot11s::HwmpProtocolMac::m_myPerr
private

PERR.

Definition at line 151 of file hwmp-protocol-mac.h.

Referenced by InitiatePerr(), and SendMyPerr().

◆ m_myPreq

std::vector<IePreq> ns3::dot11s::HwmpProtocolMac::m_myPreq
private

container of PREQs

Definition at line 137 of file hwmp-protocol-mac.h.

Referenced by RequestDestination(), and SendMyPreq().

◆ m_parent

Ptr<MeshWifiInterfaceMac> ns3::dot11s::HwmpProtocolMac::m_parent
private

◆ m_perrTimer

EventId ns3::dot11s::HwmpProtocolMac::m_perrTimer
private

PERR.

Definition at line 142 of file hwmp-protocol-mac.h.

Referenced by SendMyPerr().

◆ m_preqTimer

EventId ns3::dot11s::HwmpProtocolMac::m_preqTimer
private

Timer for PREQs.

Definition at line 136 of file hwmp-protocol-mac.h.

Referenced by SendMyPreq().

◆ m_protocol

Ptr<HwmpProtocol> ns3::dot11s::HwmpProtocolMac::m_protocol
private

◆ m_stats

Statistics ns3::dot11s::HwmpProtocolMac::m_stats
private

The documentation for this class was generated from the following files: