18#include "ns3/mesh-information-element-vector.h"
19#include "ns3/mesh-wifi-interface-mac.h"
20#include "ns3/mgt-action-headers.h"
21#include "ns3/simulator.h"
22#include "ns3/wifi-mpdu.h"
46 m_parent->TraceConnectWithoutContext(
"DroppedMpdu",
48 m_parent->TraceConnectWithoutContext(
"AckedMpdu",
75 packet->RemoveHeader(beacon_hdr);
79 packet->RemoveHeader(elements, packet->GetSize());
84 if (meshId && (
m_protocol->GetMeshId()->IsEqual(*meshId)))
94 << (*meshId) <<
"; ignoring");
105 packet->RemoveHeader(actionHdr);
122 packet->RemoveHeader(peerFrame);
132 if (!(
m_parent->CheckSupportedRates(
148 packet->RemoveHeader(peerFrame);
150 if (!(
m_parent->CheckSupportedRates(
153 NS_LOG_DEBUG(
"PEER_LINK_CONFIRM: configuration mismatch");
167 packet->RemoveHeader(peerFrame);
171 NS_LOG_DEBUG(
"PEER_LINK_CLOSE: configuration mismatch");
187 packet->RemoveHeader(elements, packet->GetSize());
192 if (peerElement->SubtypeIsOpen())
197 if (peerElement->SubtypeIsConfirm())
202 if (peerElement->SubtypeIsClose())
230 packet->PeekHeader(actionHdr);
257 if (
m_protocol->GetBeaconCollisionAvoidance())
279 packet->AddHeader(elements);
285 auto allSupportedRates =
m_parent->GetSupportedRates();
286 fields.
rates = allSupportedRates.rates;
290 fields.
config = meshConfig;
298 packet->AddHeader(plinkOpen);
299 packet->AddHeader(actionHdr);
304 auto allSupportedRates =
m_parent->GetSupportedRates();
305 fields.
rates = allSupportedRates.rates;
308 fields.
config = meshConfig;
317 packet->AddHeader(plinkConfirm);
318 packet->AddHeader(actionHdr);
331 packet->AddHeader(plinkClose);
332 packet->AddHeader(actionHdr);
345 m_parent->SendManagementFrame(packet, hdr);
393 << txOpen <<
"\"" << std::endl
394 <<
"txConfirm=\"" << txConfirm <<
"\"" << std::endl
395 <<
"txClose=\"" << txClose <<
"\"" << std::endl
396 <<
"rxOpen=\"" << rxOpen <<
"\"" << std::endl
397 <<
"rxConfirm=\"" << rxConfirm <<
"\"" << std::endl
398 <<
"rxClose=\"" << rxClose <<
"\"" << std::endl
399 <<
"dropped=\"" << dropped <<
"\"" << std::endl
400 <<
"brokenMgt=\"" << brokenMgt <<
"\"" << std::endl
401 <<
"txMgt=\"" << txMgt <<
"\"" << std::endl
402 <<
"txMgtBytes=\"" << txMgtBytes <<
"\"" << std::endl
403 <<
"rxMgt=\"" << rxMgt <<
"\"" << std::endl
404 <<
"rxMgtBytes=\"" << rxMgtBytes <<
"\"" << std::endl
405 <<
"beaconShift=\"" << beaconShift <<
"\"/>" << std::endl;
411 os <<
"<PeerManagementProtocolMac "
413 <<
m_parent->GetAddress() <<
"\">" << std::endl;
415 os <<
"</PeerManagementProtocolMac>" << std::endl;
427 return m_parent->GetLinkMetric(peerAddress);
Beacon is beacon header + list of arbitrary information elements.
Time GetBeaconInterval() const
Returns the beacon interval of Wifi beacon.
void AddInformationElement(Ptr< WifiInformationElement > ie)
Add information element.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
bool IsZero() const
Exactly equivalent to t == 0.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
void SetNeighborCount(uint8_t neighbors)
Set neighbor count.
bool IsEqual(const IeMeshId &o) const
Equality test.
according to IEEE 802.11 - 2012
bool SubtypeIsOpen() const
Subtype is open function.
bool SubtypeIsClose() const
Subtype is close function.
bool SubtypeIsConfirm() const
Subtype is confirm function.
802.11s Peer link close management frame
PlinkCloseStartFields GetFields() const
Get peer link close start fields.
void SetPlinkCloseStart(PlinkCloseStartFields fields)
Set peer link close start fields.
802.11s Peer link confirm management frame
void SetPlinkConfirmStart(PlinkConfirmStartFields fields)
Set peer link confirm start fields.
PlinkConfirmStartFields GetFields() const
Get peer link confirm start fields.
802.11s Peer link open management frame
void SetPlinkOpenStart(PlinkOpenStartFields fields)
Set peer link open start fields.
PlinkOpenStartFields GetFields() const
Get peer link open start fields.
Ptr< MeshWifiInterfaceMac > m_parent
parent
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Set pointer to parent.
PeerManagementProtocolMac(uint32_t interface, Ptr< PeerManagementProtocol > protocol)
Constructor.
void Report(std::ostream &) const
Report statistics.
Statistics m_stats
statistics
uint32_t m_ifIndex
IF index.
Mac48Address GetAddress() const
debug only, used to print established links
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.
void TxError(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
Closes link when a proper number of successive transmissions have failed.
void ResetStats()
Reset stats.
int64_t AssignStreams(int64_t stream) override
Assign the streams.
void SendPeerLinkManagementFrame(Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
Send peer link management frame function.
void TxOk(Ptr< const WifiMpdu > mpdu)
Transmit OK function.
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header) override
Receive and process a packet.
~PeerManagementProtocolMac() override
Ptr< PeerManagementProtocol > m_protocol
protocol
void SetBeaconShift(Time shift)
Set beacon shift function.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiMacDropReason
The reason why an MPDU was dropped.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Struct containing all supported rates.
IeMeshId meshId
open and close
SupportedRates rates
open and confirm
std::optional< ExtendedSupportedRatesIE > extendedRates
open and confirm
IeConfiguration config
open and confirm
uint16_t capability
open and confirm
std::optional< ExtendedSupportedRatesIE > extendedRates
open and confirm
IeConfiguration config
open and confirm
SupportedRates rates
open and confirm
IeMeshId meshId
open and close
uint16_t capability
open and confirm
uint16_t txOpen
transmit open
uint16_t txConfirm
transmit confirm
uint16_t rxConfirm
receive confirm
uint16_t rxClose
receive close
uint32_t txMgtBytes
transmit management bytes
uint16_t brokenMgt
broken management
uint16_t txClose
transmit close
uint16_t rxMgt
receive management
uint16_t rxOpen
receive open
uint16_t txMgt
transmit management
uint16_t beaconShift
beacon shift
uint32_t rxMgtBytes
receive management bytes
void Print(std::ostream &os) const
Print function.