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"
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. | |
~PeerManagementProtocolMac () override | |
int64_t | AssignStreams (int64_t stream) override |
Assign the streams. | |
bool | Receive (Ptr< Packet > packet, const WifiMacHeader &header) override |
Receive and process a packet. | |
void | SetParent (Ptr< MeshWifiInterfaceMac > parent) override |
Set pointer to parent. | |
void | UpdateBeacon (MeshWifiBeacon &beacon) const override |
Add beacon timing and mesh ID information elements, and notify beacon sent. | |
bool | UpdateOutcomingFrame (Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override |
This method appears to test a few conditions. | |
Statistics | |
void | Report (std::ostream &) const |
Report statistics. | |
void | ResetStats () |
Reset stats. | |
uint32_t | GetLinkMetric (Mac48Address peerAddress) |
Get the link metric. | |
Public Member Functions inherited from ns3::MeshWifiInterfaceMacPlugin | |
virtual | ~MeshWifiInterfaceMacPlugin () |
This is for subclasses. | |
virtual int64_t | AssignStreams (int64_t stream)=0 |
Assign a fixed random variable stream number to the random variables used by this model. | |
virtual bool | Receive (Ptr< Packet > packet, const WifiMacHeader &header)=0 |
Process received frame. | |
virtual void | SetParent (Ptr< MeshWifiInterfaceMac > parent)=0 |
Each plugin must be installed on an interface to work. | |
virtual void | UpdateBeacon (MeshWifiBeacon &beacon) const =0 |
Update beacon before it will be formed and sent. | |
virtual bool | UpdateOutcomingFrame (Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)=0 |
Update frame before it will be forwarded down. | |
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 | |
PeerManagementProtocolMac (const PeerManagementProtocolMac &) | |
type conversion operator | |
PeerManagementProtocolMac & | operator= (const PeerManagementProtocolMac &peer) |
assignment operator | |
Private Attributes | |
Information about MAC and protocol: | |
Ptr< MeshWifiInterfaceMac > | m_parent |
parent | |
uint32_t | m_ifIndex |
IF index. | |
Ptr< PeerManagementProtocol > | m_protocol |
protocol | |
Friends | |
class | PeerLink |
allow PeerLink class access friend access | |
class | PeerManagementProtocol |
allow PeerManagementProtocol class access friend access | |
Create peer link management frames | |
Statistics | m_stats |
statistics | |
Ptr< Packet > | CreatePeerLinkOpenFrame () |
Create peer link open frame function. | |
Ptr< Packet > | CreatePeerLinkConfirmFrame () |
Create peer link confirm frame function. | |
Ptr< Packet > | CreatePeerLinkCloseFrame () |
Create peer link clode frame function. | |
PlinkFrameStart | ParsePlinkFrame (Ptr< const Packet > packet) |
Parses the start of the frame, where no WifiInformationElements exist. | |
void | TxError (WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu) |
Closes link when a proper number of successive transmissions have failed. | |
void | TxOk (Ptr< const WifiMpdu > mpdu) |
Transmit OK function. | |
void | SetBeaconShift (Time shift) |
Set beacon shift function. | |
void | SetPeerManagerProtocol (Ptr< PeerManagementProtocol > protocol) |
Set peer manager protocol function. | |
void | SendPeerLinkManagementFrame (Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig) |
Send peer link management frame function. | |
Mac48Address | GetAddress () const |
debug only, used to print established links | |
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.
ns3::dot11s::PeerManagementProtocolMac::PeerManagementProtocolMac | ( | uint32_t | interface, |
Ptr< PeerManagementProtocol > | protocol | ||
) |
Constructor.
interface | interface index |
protocol | peer management protocol |
Definition at line 41 of file peer-management-protocol-mac.cc.
References m_ifIndex, and m_protocol.
|
override |
Definition at line 48 of file peer-management-protocol-mac.cc.
|
private |
type conversion operator
|
overridevirtual |
Assign the streams.
stream | the stream to assign |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 441 of file peer-management-protocol-mac.cc.
References m_protocol.
Create peer link clode frame function.
Create peer link confirm frame function.
Create peer link open frame function.
|
private |
debug only, used to print established links
Definition at line 359 of file peer-management-protocol-mac.cc.
References m_parent.
Referenced by ns3::dot11s::PeerLink::Report().
uint32_t ns3::dot11s::PeerManagementProtocolMac::GetLinkMetric | ( | Mac48Address | peerAddress | ) |
Get the link metric.
peerAddress | the peer address |
Definition at line 435 of file peer-management-protocol-mac.cc.
References m_parent.
Referenced by ns3::dot11s::PeerLink::Report().
|
private |
assignment operator
peer | the object to assign |
|
private |
Parses the start of the frame, where no WifiInformationElements exist.
packet | the packet |
|
overridevirtual |
Receive and process a packet.
packet | the packet received |
header | the header |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 75 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::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(), 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::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.
void ns3::dot11s::PeerManagementProtocolMac::Report | ( | std::ostream & | os | ) | const |
Report statistics.
os | the output stream |
Definition at line 419 of file peer-management-protocol-mac.cc.
References m_parent, m_stats, and ns3::dot11s::PeerManagementProtocolMac::Statistics::Print().
void ns3::dot11s::PeerManagementProtocolMac::ResetStats | ( | ) |
|
private |
Send peer link management frame function.
peerAddress | the peer MAC address |
peerMpAddress | the peer MP address |
aid | the AID |
peerElement | IePeerManagement |
meshConfig | IeConfiguration |
Definition at line 277 of file peer-management-protocol-mac.cc.
References 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, 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().
|
private |
Set beacon shift function.
shift | the beacon time shift |
Definition at line 372 of file peer-management-protocol-mac.cc.
References ns3::dot11s::PeerManagementProtocolMac::Statistics::beaconShift, m_parent, m_stats, and ns3::Seconds().
|
overridevirtual |
Set pointer to parent.
parent | Ptr<MeshWifiInterfaceMac> |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 53 of file peer-management-protocol-mac.cc.
References m_parent, ns3::MakeCallback(), TxError(), and TxOk().
|
private |
Set peer manager protocol function.
protocol | the peer manager protocol |
|
private |
Closes link when a proper number of successive transmissions have failed.
reason | the reason why the MPDU was dropped |
mpdu | the dropped MPDU |
Definition at line 63 of file peer-management-protocol-mac.cc.
References m_ifIndex, and m_protocol.
Referenced by SetParent().
Transmit OK function.
mpdu | the MPDU |
Definition at line 69 of file peer-management-protocol-mac.cc.
References m_ifIndex, and m_protocol.
Referenced by SetParent().
|
overridevirtual |
Add beacon timing and mesh ID information elements, and notify beacon sent.
beacon | the beacon |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 265 of file peer-management-protocol-mac.cc.
References ns3::MeshWifiBeacon::AddInformationElement(), ns3::MeshWifiBeacon::GetBeaconInterval(), m_ifIndex, and m_protocol.
|
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)
packet | the packet |
header | the header |
from | the MAC address of the sender |
to | the MAC address of the receiver |
Implements ns3::MeshWifiInterfaceMacPlugin.
Definition at line 231 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, and ns3::WifiActionHeader::SELF_PROTECTED.
|
friend |
allow PeerLink class access friend access
Definition at line 130 of file peer-management-protocol-mac.h.
|
friend |
allow PeerManagementProtocol class access friend access
Definition at line 128 of file peer-management-protocol-mac.h.
|
private |
IF index.
Definition at line 239 of file peer-management-protocol-mac.h.
Referenced by PeerManagementProtocolMac(), Receive(), TxError(), TxOk(), UpdateBeacon(), and UpdateOutcomingFrame().
|
private |
parent
Definition at line 238 of file peer-management-protocol-mac.h.
Referenced by GetAddress(), GetLinkMetric(), Receive(), Report(), SendPeerLinkManagementFrame(), SetBeaconShift(), and SetParent().
|
private |
protocol
Definition at line 240 of file peer-management-protocol-mac.h.
Referenced by PeerManagementProtocolMac(), AssignStreams(), Receive(), SendPeerLinkManagementFrame(), TxError(), TxOk(), UpdateBeacon(), and UpdateOutcomingFrame().
|
private |
statistics
Definition at line 236 of file peer-management-protocol-mac.h.
Referenced by Receive(), Report(), ResetStats(), SendPeerLinkManagementFrame(), SetBeaconShift(), and UpdateOutcomingFrame().