A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::dot11s::PeerManagementProtocolMac Class Reference

This is plugin to Mesh WiFi MAC, which implements 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
 

Public Member Functions

 PeerManagementProtocolMac (uint32_t interface, Ptr< PeerManagementProtocol > protocol)
 
 ~PeerManagementProtocolMac ()
 
Inherited from plugin abstract class
void SetParent (Ptr< MeshWifiInterfaceMac > parent)
 Each plugin must be installed on interface to work. More...
 
bool Receive (Ptr< Packet > packet, const WifiMacHeader &header)
 Process received frame. More...
 
bool UpdateOutcomingFrame (Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
 Update frame before it will be forwarded down. More...
 
void UpdateBeacon (MeshWifiBeacon &beacon) const
 Update beacon before it will be formed and sent. More...
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
- Public Member Functions inherited from ns3::MeshWifiInterfaceMacPlugin
virtual ~MeshWifiInterfaceMacPlugin ()
 This is for subclasses. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< MeshWifiInterfaceMacPlugin >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Private Member Functions

 PeerManagementProtocolMac (const PeerManagementProtocolMac &)
 
Mac48Address GetAddress () const
 debug only, used to print established links More...
 
PeerManagementProtocolMacoperator= (const PeerManagementProtocolMac &)
 
void SendPeerLinkManagementFrame (Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
 
void SetBeaconShift (Time shift)
 BCA functionality. More...
 
void SetPeerManagerProtcol (Ptr< PeerManagementProtocol > protocol)
 
void TxError (WifiMacHeader const &hdr)
 Closes link when a proper number of successive transmissions have failed. More...
 
void TxOk (WifiMacHeader const &hdr)
 
Create peer link management frames
Ptr< PacketCreatePeerLinkOpenFrame ()
 Parses the start of the frame, where no WifiInformationElements exist. More...
 
Ptr< PacketCreatePeerLinkConfirmFrame ()
 Parses the start of the frame, where no WifiInformationElements exist. More...
 
Ptr< PacketCreatePeerLinkCloseFrame ()
 Parses the start of the frame, where no WifiInformationElements exist. More...
 
PlinkFrameStart ParsePlinkFrame (Ptr< const Packet > packet)
 Parses the start of the frame, where no WifiInformationElements exist. More...
 

Private Attributes

Information about MAC and protocol:
Ptr< MeshWifiInterfaceMacm_parent
 
uint32_t m_ifIndex
 
Ptr< PeerManagementProtocolm_protocol
 

Friends

class PeerLink
 
class PeerManagementProtocol
 

Statistics

struct Statistics m_stats
 
void Report (std::ostream &) const
 
void ResetStats ()
 
uint32_t GetLinkMetric (Mac48Address peerAddress)
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::SimpleRefCount< MeshWifiInterfaceMacPlugin >
static void Cleanup (void)
 Noop. More...
 

Detailed Description

This is plugin to Mesh WiFi MAC, which implements 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 42 of file peer-management-protocol-mac.h.

Constructor & Destructor Documentation

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

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

References m_ifIndex, and m_protocol.

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

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

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

Member Function Documentation

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

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

Implements ns3::MeshWifiInterfaceMacPlugin.

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

References m_protocol.

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

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

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

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

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

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

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

debug only, used to print established links

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

References m_parent.

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

+ Here is the caller graph for this function:

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

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

References m_parent.

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

+ Here is the caller graph for this function:

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

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

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

Process received frame.

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

Implements ns3::MeshWifiInterfaceMacPlugin.

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

References ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::aid, ns3::dot11s::PeerManagementProtocolMac::Statistics::brokenMgt, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::config, ns3::Packet::Copy(), ns3::WifiInformationElementVector::FindFirst(), ns3::WifiActionHeader::GetAction(), ns3::WifiMacHeader::GetAddr2(), ns3::WifiMacHeader::GetAddr3(), ns3::MgtProbeResponseHeader::GetBeaconIntervalUs(), ns3::WifiActionHeader::GetCategory(), ns3::dot11s::PeerLinkFrameStart::GetFields(), ns3::Packet::GetSize(), IE11S_BEACON_TIMING, IE11S_MESH_ID, IE11S_PEERING_MANAGEMENT, ns3::WifiMacHeader::IsAction(), ns3::WifiMacHeader::IsBeacon(), ns3::dot11s::IeMeshId::IsEqual(), m_ifIndex, m_parent, m_protocol, m_stats, ns3::WifiActionHeader::MESH_PEERING_MGT, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::meshId, NS_ASSERT, ns3::WifiActionHeader::PEER_LINK_CLOSE, ns3::WifiActionHeader::PEER_LINK_CONFIRM, ns3::WifiActionHeader::PEER_LINK_OPEN, ns3::WifiActionHeader::ActionValue::peerLink, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::rates, 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::dot11s::PeerLinkFrameStart::SetPlinkFrameSubtype(), and ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::subtype.

+ Here is the call graph for this function:

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

Definition at line 302 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:

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

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

References m_stats.

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

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

References ns3::Packet::AddHeader(), ns3::WifiInformationElementVector::AddInformationElement(), ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::aid, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::capability, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::config, ns3::dot11s::IePeerManagement::GetReasonCode(), ns3::Packet::GetSize(), m_parent, m_protocol, m_stats, ns3::WifiActionHeader::MESH_PEERING_MGT, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::meshId, ns3::WifiActionHeader::PEER_LINK_CLOSE, ns3::WifiActionHeader::PEER_LINK_CONFIRM, ns3::WifiActionHeader::PEER_LINK_OPEN, ns3::WifiActionHeader::ActionValue::peerLink, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::rates, ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::reasonCode, ns3::WifiMacHeader::SetAction(), ns3::WifiActionHeader::SetAction(), ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::WifiMacHeader::SetDsNotFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::dot11s::IeConfiguration::SetNeighborCount(), ns3::dot11s::PeerLinkFrameStart::SetPlinkFrameStart(), ns3::dot11s::PeerLinkFrameStart::PlinkFrameStartFields::subtype, 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, and ns3::dot11s::PeerManagementProtocolMac::Statistics::txOpen.

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:

void ns3::dot11s::PeerManagementProtocolMac::SetBeaconShift ( Time  shift)
private
void ns3::dot11s::PeerManagementProtocolMac::SetParent ( Ptr< MeshWifiInterfaceMac parent)
virtual

Each plugin must be installed on interface to work.

Implements ns3::MeshWifiInterfaceMacPlugin.

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

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

+ Here is the call graph for this function:

void ns3::dot11s::PeerManagementProtocolMac::SetPeerManagerProtcol ( Ptr< PeerManagementProtocol protocol)
private
void ns3::dot11s::PeerManagementProtocolMac::TxError ( WifiMacHeader const &  hdr)
private

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

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

References ns3::WifiMacHeader::GetAddr1(), m_ifIndex, and m_protocol.

Referenced by SetParent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dot11s::PeerManagementProtocolMac::TxOk ( WifiMacHeader const &  hdr)
private

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

References ns3::WifiMacHeader::GetAddr1(), m_ifIndex, and m_protocol.

Referenced by SetParent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Update beacon before it will be formed and sent.

Todo:
define when MAC call this

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 184 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:

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

Update frame before it will be forwarded down.

Returns
false if (and only if) frame should be dropped
Todo:
define when MAC call this, preconditions & postconditions

Implements ns3::MeshWifiInterfaceMacPlugin.

Definition at line 154 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, ns3::WifiActionHeader::MESH_PEERING_MGT, and ns3::Packet::PeekHeader().

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class PeerLink
friend

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

friend class PeerManagementProtocol
friend

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

Member Data Documentation

uint32_t ns3::dot11s::PeerManagementProtocolMac::m_ifIndex
private
Ptr<MeshWifiInterfaceMac> ns3::dot11s::PeerManagementProtocolMac::m_parent
private
Ptr<PeerManagementProtocol> ns3::dot11s::PeerManagementProtocolMac::m_protocol
private
struct Statistics ns3::dot11s::PeerManagementProtocolMac::m_stats
private

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