A Discrete-Event Network Simulator
API
ns3::dot11s::PeerManagementProtocolMac Class Reference

This is plugin to Mesh WiFi MAC, which implements the interface to dot11s peer management protocol: it takes proper frames from MAC-layer, extracts peer link management information element and mesh configuration element and passes it to main part of protocol. More...

#include "peer-management-protocol-mac.h"

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

Classes

struct  PlinkFrameStart
 This structure keeps all fields in peer link management frame, which are not subclasses of WifiInformationElement. More...
 
struct  Statistics
 Statistics structure. More...
 

Public Member Functions

 PeerManagementProtocolMac (uint32_t interface, Ptr< PeerManagementProtocol > protocol)
 Constructor. More...
 
 ~PeerManagementProtocolMac () override
 
int64_t AssignStreams (int64_t stream) override
 Assign the streams. More...
 
bool Receive (Ptr< Packet > packet, const WifiMacHeader &header) override
 Receive and process a packet. More...
 
void SetParent (Ptr< MeshWifiInterfaceMac > parent) override
 Set pointer to parent. More...
 
void UpdateBeacon (MeshWifiBeacon &beacon) const override
 Add beacon timing and mesh ID information elements, and notify beacon sent. More...
 
bool UpdateOutcomingFrame (Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override
 This method appears to test a few conditions. More...
 
Statistics
void Report (std::ostream &) const
 Report statistics. More...
 
void ResetStats ()
 Reset stats. More...
 
uint32_t GetLinkMetric (Mac48Address peerAddress)
 Get the link metric. 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 () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 

Private Member Functions

 PeerManagementProtocolMac (const PeerManagementProtocolMac &)
 type conversion operator More...
 
PeerManagementProtocolMacoperator= (const PeerManagementProtocolMac &peer)
 assignment operator More...
 

Private Attributes

Information about MAC and protocol:
Ptr< MeshWifiInterfaceMacm_parent
 parent More...
 
uint32_t m_ifIndex
 IF index. More...
 
Ptr< PeerManagementProtocolm_protocol
 protocol More...
 

Friends

class PeerLink
 allow PeerLink class access friend access More...
 
class PeerManagementProtocol
 allow PeerManagementProtocol class access friend access More...
 

Create peer link management frames

Statistics m_stats
 statistics More...
 
Ptr< PacketCreatePeerLinkOpenFrame ()
 Create peer link open frame function. More...
 
Ptr< PacketCreatePeerLinkConfirmFrame ()
 Create peer link confirm frame function. More...
 
Ptr< PacketCreatePeerLinkCloseFrame ()
 Create peer link clode frame function. More...
 
PlinkFrameStart ParsePlinkFrame (Ptr< const Packet > packet)
 Parses the start of the frame, where no WifiInformationElements exist. More...
 
void TxError (WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
 Closes link when a proper number of successive transmissions have failed. More...
 
void TxOk (Ptr< const WifiMpdu > mpdu)
 Transmit OK function. More...
 
void SetBeaconShift (Time shift)
 Set beacon shift function. More...
 
void SetPeerManagerProtocol (Ptr< PeerManagementProtocol > protocol)
 Set peer manager protocol function. More...
 
void SendPeerLinkManagementFrame (Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
 Send peer link management frame function. More...
 
Mac48Address GetAddress () const
 debug only, used to print established links More...
 

Detailed Description

This is plugin to Mesh WiFi MAC, which implements the interface to dot11s peer management protocol: it takes proper frames from MAC-layer, extracts peer link management information element and mesh configuration element and passes it to main part of protocol.

Definition at line 47 of file peer-management-protocol-mac.h.

Constructor & Destructor Documentation

◆ PeerManagementProtocolMac() [1/2]

ns3::dot11s::PeerManagementProtocolMac::PeerManagementProtocolMac ( uint32_t  interface,
Ptr< PeerManagementProtocol protocol 
)

Constructor.

Parameters
interfaceinterface index
protocolpeer management protocol

Definition at line 42 of file peer-management-protocol-mac.cc.

References m_ifIndex, and m_protocol.

◆ ~PeerManagementProtocolMac()

ns3::dot11s::PeerManagementProtocolMac::~PeerManagementProtocolMac ( )
override

Definition at line 49 of file peer-management-protocol-mac.cc.

◆ PeerManagementProtocolMac() [2/2]

ns3::dot11s::PeerManagementProtocolMac::PeerManagementProtocolMac ( const PeerManagementProtocolMac )
private

type conversion operator

Member Function Documentation

◆ AssignStreams()

int64_t ns3::dot11s::PeerManagementProtocolMac::AssignStreams ( int64_t  stream)
overridevirtual

Assign the streams.

Parameters
streamthe stream to assign
Returns
the assigned stream

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 442 of file peer-management-protocol-mac.cc.

References m_protocol.

◆ CreatePeerLinkCloseFrame()

Ptr<Packet> ns3::dot11s::PeerManagementProtocolMac::CreatePeerLinkCloseFrame ( )
private

Create peer link clode frame function.

Returns
the packet

◆ CreatePeerLinkConfirmFrame()

Ptr<Packet> ns3::dot11s::PeerManagementProtocolMac::CreatePeerLinkConfirmFrame ( )
private

Create peer link confirm frame function.

Returns
the packet

◆ CreatePeerLinkOpenFrame()

Ptr<Packet> ns3::dot11s::PeerManagementProtocolMac::CreatePeerLinkOpenFrame ( )
private

Create peer link open frame function.

Returns
the packet

◆ GetAddress()

Mac48Address ns3::dot11s::PeerManagementProtocolMac::GetAddress ( ) const
private

debug only, used to print established links

Returns
the MAC address

Definition at line 360 of file peer-management-protocol-mac.cc.

References m_parent.

Referenced by ns3::dot11s::PeerLink::Report().

+ Here is the caller graph for this function:

◆ GetLinkMetric()

uint32_t ns3::dot11s::PeerManagementProtocolMac::GetLinkMetric ( Mac48Address  peerAddress)

Get the link metric.

Parameters
peerAddressthe peer address
Returns
The metric

Definition at line 436 of file peer-management-protocol-mac.cc.

References m_parent.

Referenced by ns3::dot11s::PeerLink::Report().

+ Here is the caller graph for this function:

◆ operator=()

PeerManagementProtocolMac& ns3::dot11s::PeerManagementProtocolMac::operator= ( const PeerManagementProtocolMac peer)
private

assignment operator

Parameters
peerthe object to assign
Returns
the assigned value

◆ ParsePlinkFrame()

PlinkFrameStart ns3::dot11s::PeerManagementProtocolMac::ParsePlinkFrame ( Ptr< const Packet packet)
private

Parses the start of the frame, where no WifiInformationElements exist.

Parameters
packetthe packet
Returns
PlinkFrameStart

◆ Receive()

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

Receive and process a packet.

Parameters
packetthe packet received
headerthe header
Returns
true if received

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 76 of file peer-management-protocol-mac.cc.

References ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::aid, ns3::dot11s::PeerManagementProtocolMac::Statistics::brokenMgt, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::config, ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::config, ns3::Packet::Copy(), ns3::MeshInformationElementVector::FindFirst(), ns3::WifiActionHeader::GetAction(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetAddr3(), ns3::MgtProbeResponseHeader::GetBeaconIntervalUs(), ns3::WifiActionHeader::GetCategory(), ns3::dot11s::PeerLinkOpenStart::GetFields(), ns3::dot11s::PeerLinkCloseStart::GetFields(), ns3::dot11s::PeerLinkConfirmStart::GetFields(), ns3::Packet::GetSize(), IE_BEACON_TIMING, IE_MESH_ID, IE_MESH_PEERING_MANAGEMENT, ns3::WifiMacHeader::IsAction(), ns3::WifiMacHeader::IsBeacon(), ns3::dot11s::IeMeshId::IsEqual(), m_ifIndex, m_parent, m_protocol, m_stats, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::meshId, ns3::dot11s::PeerLinkCloseStart::PlinkCloseStartFields::meshId, ns3::MicroSeconds(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WifiActionHeader::PEER_LINK_CLOSE, ns3::WifiActionHeader::PEER_LINK_CONFIRM, ns3::WifiActionHeader::PEER_LINK_OPEN, ns3::Packet::RemoveHeader(), ns3::dot11s::PeerManagementProtocolMac::Statistics::rxClose, ns3::dot11s::PeerManagementProtocolMac::Statistics::rxConfirm, ns3::dot11s::PeerManagementProtocolMac::Statistics::rxMgt, ns3::dot11s::PeerManagementProtocolMac::Statistics::rxMgtBytes, ns3::dot11s::PeerManagementProtocolMac::Statistics::rxOpen, ns3::WifiActionHeader::SELF_PROTECTED, and ns3::WifiActionHeader::ActionValue::selfProtectedAction.

+ Here is the call graph for this function:

◆ Report()

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

Report statistics.

Parameters
osthe output stream

Definition at line 420 of file peer-management-protocol-mac.cc.

References m_parent, m_stats, and ns3::dot11s::PeerManagementProtocolMac::Statistics::Print().

+ Here is the call graph for this function:

◆ ResetStats()

void ns3::dot11s::PeerManagementProtocolMac::ResetStats ( )

Reset stats.

Definition at line 430 of file peer-management-protocol-mac.cc.

References m_stats.

◆ SendPeerLinkManagementFrame()

void ns3::dot11s::PeerManagementProtocolMac::SendPeerLinkManagementFrame ( Mac48Address  peerAddress,
Mac48Address  peerMpAddress,
uint16_t  aid,
IePeerManagement  peerElement,
IeConfiguration  meshConfig 
)
private

Send peer link management frame function.

Parameters
peerAddressthe peer MAC address
peerMpAddressthe peer MP address
aidthe AID
peerElementIePeerManagement
meshConfigIeConfiguration

Definition at line 278 of file peer-management-protocol-mac.cc.

References check-style-clang-format::action, ns3::Packet::AddHeader(), ns3::MeshInformationElementVector::AddInformationElement(), ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::aid, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::capability, ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::capability, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::config, ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::config, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::extendedRates, ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::extendedRates, ns3::Packet::GetSize(), m_parent, m_protocol, m_stats, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::meshId, ns3::dot11s::PeerLinkCloseStart::PlinkCloseStartFields::meshId, NS_LOG_FUNCTION, ns3::WifiActionHeader::PEER_LINK_CLOSE, ns3::WifiActionHeader::PEER_LINK_CONFIRM, ns3::WifiActionHeader::PEER_LINK_OPEN, ns3::dot11s::PeerLinkOpenStart::PlinkOpenStartFields::rates, ns3::dot11s::PeerLinkConfirmStart::PlinkConfirmStartFields::rates, ns3::WifiActionHeader::SELF_PROTECTED, ns3::WifiActionHeader::SetAction(), ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::dot11s::IeConfiguration::SetNeighborCount(), ns3::dot11s::PeerLinkCloseStart::SetPlinkCloseStart(), ns3::dot11s::PeerLinkConfirmStart::SetPlinkConfirmStart(), ns3::dot11s::PeerLinkOpenStart::SetPlinkOpenStart(), ns3::WifiMacHeader::SetType(), ns3::dot11s::IePeerManagement::SubtypeIsClose(), ns3::dot11s::IePeerManagement::SubtypeIsConfirm(), ns3::dot11s::IePeerManagement::SubtypeIsOpen(), ns3::dot11s::PeerManagementProtocolMac::Statistics::txClose, ns3::dot11s::PeerManagementProtocolMac::Statistics::txConfirm, ns3::dot11s::PeerManagementProtocolMac::Statistics::txMgt, ns3::dot11s::PeerManagementProtocolMac::Statistics::txMgtBytes, ns3::dot11s::PeerManagementProtocolMac::Statistics::txOpen, and ns3::WIFI_MAC_MGT_ACTION.

Referenced by ns3::dot11s::PeerLink::SendPeerLinkClose(), ns3::dot11s::PeerLink::SendPeerLinkConfirm(), and ns3::dot11s::PeerLink::SendPeerLinkOpen().

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

◆ SetBeaconShift()

void ns3::dot11s::PeerManagementProtocolMac::SetBeaconShift ( Time  shift)
private

Set beacon shift function.

Parameters
shiftthe beacon time shift

Definition at line 373 of file peer-management-protocol-mac.cc.

References ns3::dot11s::PeerManagementProtocolMac::Statistics::beaconShift, m_parent, m_stats, and ns3::Seconds().

+ Here is the call graph for this function:

◆ SetParent()

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

Set pointer to parent.

Parameters
parentPtr<MeshWifiInterfaceMac>

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 54 of file peer-management-protocol-mac.cc.

References m_parent, ns3::MakeCallback(), TxError(), and TxOk().

+ Here is the call graph for this function:

◆ SetPeerManagerProtocol()

void ns3::dot11s::PeerManagementProtocolMac::SetPeerManagerProtocol ( Ptr< PeerManagementProtocol protocol)
private

Set peer manager protocol function.

Parameters
protocolthe peer manager protocol

◆ TxError()

void ns3::dot11s::PeerManagementProtocolMac::TxError ( WifiMacDropReason  reason,
Ptr< const WifiMpdu mpdu 
)
private

Closes link when a proper number of successive transmissions have failed.

Parameters
reasonthe reason why the MPDU was dropped
mpduthe dropped MPDU

Definition at line 64 of file peer-management-protocol-mac.cc.

References m_ifIndex, and m_protocol.

Referenced by SetParent().

+ Here is the caller graph for this function:

◆ TxOk()

void ns3::dot11s::PeerManagementProtocolMac::TxOk ( Ptr< const WifiMpdu mpdu)
private

Transmit OK function.

Parameters
mpduthe MPDU

Definition at line 70 of file peer-management-protocol-mac.cc.

References m_ifIndex, and m_protocol.

Referenced by SetParent().

+ Here is the caller graph for this function:

◆ UpdateBeacon()

void ns3::dot11s::PeerManagementProtocolMac::UpdateBeacon ( MeshWifiBeacon beacon) const
overridevirtual

Add beacon timing and mesh ID information elements, and notify beacon sent.

Parameters
beaconthe beacon

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 266 of file peer-management-protocol-mac.cc.

References ns3::MeshWifiBeacon::AddInformationElement(), ns3::MeshWifiBeacon::GetBeaconInterval(), m_ifIndex, and m_protocol.

+ Here is the call graph for this function:

◆ UpdateOutcomingFrame()

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

This method appears to test a few conditions.

If an action frame, it returns true if SELF_PROTECTED. It then checks if it is either a broadcast or sent on an active link, and returns true if so. Otherwise, it returns false (indicating it is to be dropped)

Parameters
packetthe packet
headerthe header
fromthe MAC address of the sender
tothe MAC address of the receiver
Returns
true if successful, false if to be dropped

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 232 of file peer-management-protocol-mac.cc.

References ns3::dot11s::PeerManagementProtocolMac::Statistics::dropped, ns3::WifiMacHeader::GetAddr1(), ns3::WifiActionHeader::GetCategory(), ns3::WifiMacHeader::IsAction(), ns3::Mac48Address::IsGroup(), m_ifIndex, m_protocol, m_stats, NS_LOG_FUNCTION, ns3::Packet::PeekHeader(), and ns3::WifiActionHeader::SELF_PROTECTED.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ PeerLink

friend class PeerLink
friend

allow PeerLink class access friend access

Definition at line 130 of file peer-management-protocol-mac.h.

◆ PeerManagementProtocol

friend class PeerManagementProtocol
friend

allow PeerManagementProtocol class access friend access

Definition at line 128 of file peer-management-protocol-mac.h.

Member Data Documentation

◆ m_ifIndex

uint32_t ns3::dot11s::PeerManagementProtocolMac::m_ifIndex
private

◆ m_parent

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

◆ m_protocol

Ptr<PeerManagementProtocol> ns3::dot11s::PeerManagementProtocolMac::m_protocol
private

◆ m_stats

Statistics ns3::dot11s::PeerManagementProtocolMac::m_stats
private

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