16#include "ns3/simulator.h"
17#include "ns3/traced-value.h"
33 TypeId(
"ns3::dot11s::PeerLink")
37 .AddAttribute(
"RetryTimeout",
42 .AddAttribute(
"HoldingTimeout",
47 .AddAttribute(
"ConfirmTimeout",
52 .AddAttribute(
"MaxRetries",
53 "Maximum number of retries",
57 .AddAttribute(
"MaxBeaconLoss",
58 "Maximum number of lost beacons before link will be closed",
62 .AddAttribute(
"MaxPacketFailure",
63 "Maximum number of failed packets before link will be closed",
71 {
"IDLE",
"OPN_SNT",
"CNF_RCVD",
"OPN_RCVD",
"ESTAB",
"HOLDING"};
310 NS_LOG_FUNCTION(
this << localLinkId << peerLinkId << peerAid << peerMp);
346 NS_LOG_FUNCTION(
this << localLinkId << peerLinkId << peerMp << reason);
842 os <<
"<PeerLink" << std::endl
844 <<
"peerInterfaceAddress=\"" <<
m_peerAddress <<
"\"" << std::endl
850 <<
"assocId=\"" <<
m_assocId <<
"\"" << std::endl
851 <<
"/>" << std::endl;
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
static Mac48Address GetBroadcast()
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
See 7.3.2.89 of 802.11s draft 2.07.
void ClearTimingElement()
Clear timing element.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
according to IEEE 802.11 - 2012
void SetPeerConfirm(uint16_t localLinkID, uint16_t peerLinkId)
Set peer confirm function.
void SetPeerOpen(uint16_t localLinkId)
Set peer open function.
void SetPeerClose(uint16_t localLinkID, uint16_t peerLinkId, PmpReasonCode reasonCode)
Set peer close function.
Peer link model for 802.11s Peer Management protocol.
Time m_lastBeacon
When last beacon was received.
Ptr< PeerManagementProtocolMac > m_macPlugin
pointer to MAC plugin, which is responsible for peer management
void MLMEActivePeerLinkOpen()
MLME-ActivePeerLinkOpen.request.
static TypeId GetTypeId()
Get the type ID.
void SendPeerLinkOpen()
Send a peer link open.
Time m_dot11MeshRetryTimeout
Retry timeout.
void SetHoldingTimer()
Set the holding timer.
void OpenAccept(uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp)
Accept open link.
void TransmissionFailure()
Callback type for MLME-SignalPeerLinkStatus event.
void RetryTimeout()
Retry Timeout event handler.
void SetRetryTimer()
Set the retry timer.
void MLMESetSignalStatusCallback(SignalStatusCallback cb)
Set callback.
void DoDispose() override
Destructor implementation.
void StateMachine(PeerEvent event, PmpReasonCode=REASON11S_RESERVED)
State transition.
Time m_dot11MeshConfirmTimeout
Confirm timeout.
static const char *const PeerStateNames[6]
Literal names of Mesh Peer Management states for use in log messages.
void SetBeaconInformation(Time lastBeacon, Time BeaconInterval)
Process beacon received from peer.
void Close(uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason)
Close link.
void SetLocalLinkId(uint16_t id)
Set the local link ID.
uint16_t m_maxBeaconLoss
Maximum number of lost beacons before link will be closed.
Mac48Address m_peerMeshPointAddress
Mesh point address, equal to peer address in case of single interface mesh point.
void ConfirmTimeout()
Confirm Timeout event handler.
uint16_t m_maxPacketFail
Maximum number of failed packets before link will be closed.
void SetLocalAid(uint16_t aid)
Set the local association ID.
uint32_t m_interface
The number of interface I am associated with.
void MLMEPeeringRequestReject()
MLME-PeeringRequestReject.
void BeaconLoss()
Several successive beacons were lost, close link.
void MLMECancelPeerLink(PmpReasonCode reason)
MLME-CancelPeerLink.request.
uint16_t m_peerAssocId
Assoc Id assigned to me by peer.
PeerState m_state
Current state.
void SendPeerLinkClose(PmpReasonCode reasoncode)
Send a peer link close.
void ConfirmReject(uint16_t localLinkId, uint16_t peerLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason)
Confirm reject.
Time m_beaconInterval
Current beacon interval on corresponding interface.
void SetPeerAddress(Mac48Address macaddr)
Set the peer address.
void ClearConfirmTimer()
Clear the confirm timer.
EventId m_holdingTimer
Holding timer.
void SetBeaconTimingElement(IeBeaconTiming beaconTiming)
Set the beacon timing element.
EventId m_retryTimer
Retry timer.
void ClearHoldingTimer()
Clear the holding timer.
void SetMacPlugin(Ptr< PeerManagementProtocolMac > plugin)
Set pointer to MAC-plugin, which is responsible for sending peer link management frames.
void SetPeerMeshPointAddress(Mac48Address macaddr)
Set the peer mesh point address.
PeerLink()
C-tor create empty link.
Time GetLastBeacon() const
Get the time of the last received beacon.
SignalStatusCallback m_linkStatusCallback
How to report my status change.
void Report(std::ostream &os) const
Statistics.
void OpenReject(uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason)
Reject open link.
Mac48Address GetPeerAddress() const
Get the peer address.
Time GetBeaconInterval() const
Get the beacon interval.
Mac48Address m_peerAddress
Peer address.
void SetConfirmTimer()
Set the confirm timer.
IeConfiguration m_configuration
Mesh interface configuration.
void ConfirmAccept(uint16_t localLinkId, uint16_t peerLinkId, uint16_t peerAid, IeConfiguration conf, Mac48Address peerMp)
Confirm accept.
IeBeaconTiming m_beaconTiming
Beacon timing element received from the peer. Needed by BCA.
IeBeaconTiming GetBeaconTimingElement() const
Get the beacon timing element.
void TransmissionSuccess()
Reports about transmission success/failure.
void SendPeerLinkConfirm()
Send a peer link confirm.
PeerEvent
Peer link events, see 802.11s draft 11B.3.3.2.
@ TOR1
Timeout of retry timer.
@ TOH
Timeout of holding (graceful closing) timer.
@ CNF_ACPT
PeerLinkConfirm_Accept.
@ CLS_ACPT
PeerLinkClose_Accept.
@ TOC
Timeout of confirm timer.
@ ACTOPN
Active peer link open.
@ OPN_RJCT
PeerLinkOpen_Reject.
@ TOR2
also timeout of retry timer
@ CNF_RJCT
PeerLinkConfirm_Reject.
@ OPN_ACPT
PeerLinkOpen_Accept.
@ REQ_RJCT
PeerLinkOpenReject by internal reason.
EventId m_beaconLossTimer
Beacon loss timer.
uint16_t GetLocalAid() const
Get the local association ID.
uint16_t m_retryCounter
Retry counter.
uint16_t m_dot11MeshMaxRetries
Maximum number of retries.
uint16_t m_localLinkId
My ID of this link.
uint16_t m_packetFail
How many successive packets were failed to transmit.
uint16_t GetPeerAid() const
Set the peer association ID.
void SetInterface(uint32_t interface)
Set the interface.
uint16_t m_assocId
My association ID.
Time m_dot11MeshHoldingTimeout
Holding timeout.
uint16_t m_peerLinkId
Peer ID of this link.
EventId m_confirmTimer
Confirm timer.
Mac48Address GetAddress() const
debug only, used to print established links
void SendPeerLinkManagementFrame(Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
Send peer link management frame function.
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
PmpReasonCode
Codes used by 802.11s Peer Management Protocol.
@ REASON11S_MESH_CLOSE_RCVD
@ REASON11S_MESH_MAX_RETRIES
@ REASON11S_PEERING_CANCELLED
@ REASON11S_MESH_CONFIRM_TIMEOUT
#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_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ IDLE
Channel is IDLE, no packet is being transmitted.