A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
peer-management-protocol.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008,2009 IITP RAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Kirill Andreev <andreev@iitp.ru>
18 * Aleksey Kovalenko <kovalenko@iitp.ru>
19 */
20
21#include "ns3/peer-management-protocol.h"
22
24#include "ie-dot11s-id.h"
26
27#include "ns3/assert.h"
28#include "ns3/log.h"
29#include "ns3/mesh-point-device.h"
30#include "ns3/mesh-wifi-interface-mac-plugin.h"
31#include "ns3/mesh-wifi-interface-mac.h"
32#include "ns3/random-variable-stream.h"
33#include "ns3/simulator.h"
34#include "ns3/trace-source-accessor.h"
35#include "ns3/wifi-net-device.h"
36
37namespace ns3
38{
39
40NS_LOG_COMPONENT_DEFINE("PeerManagementProtocol");
41
42namespace dot11s
43{
44
45/***************************************************
46 * PeerManager
47 ***************************************************/
48NS_OBJECT_ENSURE_REGISTERED(PeerManagementProtocol);
49
50TypeId
52{
53 static TypeId tid =
54 TypeId("ns3::dot11s::PeerManagementProtocol")
56 .SetGroupName("Mesh")
57 .AddConstructor<PeerManagementProtocol>()
58 // maximum number of peer links. Now we calculate the total
59 // number of peer links on all interfaces
60 .AddAttribute("MaxNumberOfPeerLinks",
61 "Maximum number of peer links",
62 UintegerValue(32),
64 MakeUintegerChecker<uint8_t>())
65 .AddAttribute("MaxBeaconShiftValue",
66 "Maximum number of TUs for beacon shifting",
67 UintegerValue(15),
69 MakeUintegerChecker<uint16_t>())
70 .AddAttribute("EnableBeaconCollisionAvoidance",
71 "Enable/Disable Beacon collision avoidance.",
72 BooleanValue(true),
76 .AddTraceSource("LinkOpen",
77 "New peer link opened",
79 "ns3::PeerManagementProtocol::LinkOpenCloseTracedCallback")
80 .AddTraceSource("LinkClose",
81 "New peer link closed",
83 "ns3::PeerManagementProtocol::LinkOpenCloseTracedCallback")
84
85 ;
86 return tid;
87}
88
90 : m_lastAssocId(0),
91 m_lastLocalLinkId(1),
92 m_enableBca(true),
93 m_maxBeaconShift(15)
94{
95 m_beaconShift = CreateObject<UniformRandomVariable>();
96}
97
99{
100 m_meshId = nullptr;
101}
102
103void
105{
106 // cancel cleanup event and go through the map of peer links,
107 // deleting each
108 for (PeerLinksMap::iterator j = m_peerLinks.begin(); j != m_peerLinks.end(); j++)
109 {
110 for (PeerLinksOnInterface::iterator i = j->second.begin(); i != j->second.end(); i++)
111 {
112 (*i) = nullptr;
113 }
114 j->second.clear();
115 }
116 m_peerLinks.clear();
117 m_plugins.clear();
118}
119
120bool
122{
123 std::vector<Ptr<NetDevice>> interfaces = mp->GetInterfaces();
124 for (std::vector<Ptr<NetDevice>>::iterator i = interfaces.begin(); i != interfaces.end(); i++)
125 {
126 Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice>();
127 if (!wifiNetDev)
128 {
129 return false;
130 }
131 Ptr<MeshWifiInterfaceMac> mac = wifiNetDev->GetMac()->GetObject<MeshWifiInterfaceMac>();
132 if (!mac)
133 {
134 return false;
135 }
137 Create<PeerManagementProtocolMac>((*i)->GetIfIndex(), this);
138 mac->InstallPlugin(plugin);
139 m_plugins[(*i)->GetIfIndex()] = plugin;
141 m_peerLinks[(*i)->GetIfIndex()] = newmap;
142 }
143 // Mesh point aggregates all installed protocols
144 m_address = Mac48Address::ConvertFrom(mp->GetAddress());
145 mp->AggregateObject(this);
146 return true;
147}
148
151{
153 {
154 return nullptr;
155 }
156 Ptr<IeBeaconTiming> retval = Create<IeBeaconTiming>();
157 PeerLinksMap::iterator iface = m_peerLinks.find(interface);
158 NS_ASSERT(iface != m_peerLinks.end());
159 for (PeerLinksOnInterface::iterator i = iface->second.begin(); i != iface->second.end(); i++)
160 {
161 // If we do not know peer Assoc Id, we shall not add any info
162 // to a beacon timing element
163 if ((*i)->GetBeaconInterval() == Seconds(0))
164 {
165 // No beacon was received, do not include to the beacon timing element
166 continue;
167 }
168 retval->AddNeighboursTimingElementUnit((*i)->GetLocalAid(),
169 (*i)->GetLastBeacon(),
170 (*i)->GetBeaconInterval());
171 }
172 return retval;
173}
174
175void
177 Mac48Address peerAddress,
178 Time beaconInterval,
179 Ptr<IeBeaconTiming> timingElement)
180{
181 // PM STATE Machine
182 // Check that a given beacon is not from our interface
183 for (PeerManagementProtocolMacMap::const_iterator i = m_plugins.begin(); i != m_plugins.end();
184 i++)
185 {
186 if (i->second->GetAddress() == peerAddress)
187 {
188 return;
189 }
190 }
191 Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
192 if (!peerLink)
193 {
194 if (ShouldSendOpen(interface, peerAddress))
195 {
196 peerLink = InitiateLink(interface, peerAddress, Mac48Address::GetBroadcast());
197 peerLink->MLMEActivePeerLinkOpen();
198 }
199 else
200 {
201 return;
202 }
203 }
204 peerLink->SetBeaconInformation(Simulator::Now(), beaconInterval);
206 {
207 peerLink->SetBeaconTimingElement(*PeekPointer(timingElement));
208 }
209}
210
211void
213 Mac48Address peerAddress,
214 Mac48Address peerMeshPointAddress,
215 uint16_t aid,
216 IePeerManagement peerManagementElement,
217 IeConfiguration meshConfig)
218{
219 Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
220 if (peerManagementElement.SubtypeIsOpen())
221 {
223 bool reject = !(ShouldAcceptOpen(interface, peerAddress, reasonCode));
224 if (!peerLink)
225 {
226 peerLink = InitiateLink(interface, peerAddress, peerMeshPointAddress);
227 }
228 if (!reject)
229 {
230 peerLink->OpenAccept(peerManagementElement.GetLocalLinkId(),
231 meshConfig,
232 peerMeshPointAddress);
233 }
234 else
235 {
236 peerLink->OpenReject(peerManagementElement.GetLocalLinkId(),
237 meshConfig,
238 peerMeshPointAddress,
239 reasonCode);
240 }
241 }
242 if (!peerLink)
243 {
244 return;
245 }
246 if (peerManagementElement.SubtypeIsConfirm())
247 {
248 peerLink->ConfirmAccept(peerManagementElement.GetLocalLinkId(),
249 peerManagementElement.GetPeerLinkId(),
250 aid,
251 meshConfig,
252 peerMeshPointAddress);
253 }
254 if (peerManagementElement.SubtypeIsClose())
255 {
256 peerLink->Close(peerManagementElement.GetLocalLinkId(),
257 peerManagementElement.GetPeerLinkId(),
258 peerManagementElement.GetReasonCode());
259 }
260}
261
262void
264{
265 Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
266 if (peerLink)
267 {
268 peerLink->MLMECancelPeerLink(REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
269 }
270}
271
272void
274{
275 NS_LOG_DEBUG("transmission failed between " << GetAddress() << " and " << peerAddress
276 << " failed, link will be closed");
277 Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
278 if (peerLink)
279 {
280 peerLink->TransmissionFailure();
281 }
282}
283
284void
286{
287 NS_LOG_DEBUG("transmission success " << GetAddress() << " and " << peerAddress);
288 Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
289 if (peerLink)
290 {
291 peerLink->TransmissionSuccess();
292 }
293}
294
297 Mac48Address peerAddress,
298 Mac48Address peerMeshPointAddress)
299{
300 Ptr<PeerLink> new_link = CreateObject<PeerLink>();
301 // find a peer link - it must not exist
302 if (FindPeerLink(interface, peerAddress))
303 {
304 NS_FATAL_ERROR("Peer link must not exist.");
305 }
306 // Plugin must exist
307 PeerManagementProtocolMacMap::iterator plugin = m_plugins.find(interface);
308 NS_ASSERT(plugin != m_plugins.end());
309 PeerLinksMap::iterator iface = m_peerLinks.find(interface);
310 NS_ASSERT(iface != m_peerLinks.end());
311 new_link->SetLocalAid(m_lastAssocId++);
312 new_link->SetInterface(interface);
313 new_link->SetLocalLinkId(m_lastLocalLinkId++);
314 new_link->SetPeerAddress(peerAddress);
315 new_link->SetPeerMeshPointAddress(peerMeshPointAddress);
316 new_link->SetMacPlugin(plugin->second);
317 new_link->MLMESetSignalStatusCallback(
319 iface->second.push_back(new_link);
320 return new_link;
321}
322
325{
326 PeerLinksMap::iterator iface = m_peerLinks.find(interface);
327 NS_ASSERT(iface != m_peerLinks.end());
328 for (PeerLinksOnInterface::iterator i = iface->second.begin(); i != iface->second.end(); i++)
329 {
330 if ((*i)->GetPeerAddress() == peerAddress)
331 {
332 if ((*i)->LinkIsIdle())
333 {
334 (*i) = nullptr;
335 (iface->second).erase(i);
336 return nullptr;
337 }
338 else
339 {
340 return (*i);
341 }
342 }
343 }
344 return nullptr;
345}
346
347void
350{
352}
353
354std::vector<Mac48Address>
356{
357 std::vector<Mac48Address> retval;
358 PeerLinksMap::const_iterator iface = m_peerLinks.find(interface);
359 NS_ASSERT(iface != m_peerLinks.end());
360 for (PeerLinksOnInterface::const_iterator i = iface->second.begin(); i != iface->second.end();
361 i++)
362 {
363 if ((*i)->LinkIsEstab())
364 {
365 retval.push_back((*i)->GetPeerAddress());
366 }
367 }
368 return retval;
369}
370
371std::vector<Ptr<PeerLink>>
373{
374 std::vector<Ptr<PeerLink>> links;
375
376 for (PeerLinksMap::const_iterator iface = m_peerLinks.begin(); iface != m_peerLinks.end();
377 ++iface)
378 {
379 for (PeerLinksOnInterface::const_iterator i = iface->second.begin();
380 i != iface->second.end();
381 i++)
382 {
383 if ((*i)->LinkIsEstab())
384 {
385 links.push_back(*i);
386 }
387 }
388 }
389 return links;
390}
391
392bool
394{
395 Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
396 if (peerLink)
397 {
398 return (peerLink->LinkIsEstab());
399 }
400 return false;
401}
402
403bool
405{
407}
408
409bool
411 Mac48Address peerAddress,
412 PmpReasonCode& reasonCode) const
413{
415 {
416 reasonCode = REASON11S_MESH_MAX_PEERS;
417 return false;
418 }
419 return true;
420}
421
422void
424{
426 {
427 return;
428 }
429 PeerLinksMap::iterator iface = m_peerLinks.find(interface);
430 NS_ASSERT(iface != m_peerLinks.end());
431 NS_ASSERT(m_plugins.find(interface) != m_plugins.end());
432
433 std::map<uint32_t, Time>::const_iterator lastBeacon = m_lastBeacon.find(interface);
434 std::map<uint32_t, Time>::const_iterator beaconInterval = m_beaconInterval.find(interface);
435 if ((lastBeacon == m_lastBeacon.end()) || (beaconInterval == m_beaconInterval.end()))
436 {
437 return;
438 }
439 // my last beacon in 256 us units
440 uint16_t lastBeaconInTimeElement =
441 (uint16_t)((lastBeacon->second.GetMicroSeconds() >> 8) & 0xffff);
442
444 "Wrong beacon shift parameters");
445
446 if (iface->second.empty())
447 {
448 // I have no peers - may be our beacons are in collision
449 ShiftOwnBeacon(interface);
450 return;
451 }
452 // check whether all my peers receive my beacon and I'am not in collision with other beacons
453
454 for (PeerLinksOnInterface::iterator i = iface->second.begin(); i != iface->second.end(); i++)
455 {
456 bool myBeaconExists = false;
458 (*i)->GetBeaconTimingElement().GetNeighboursTimingElementsList();
459 for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbors.begin();
460 j != neighbors.end();
461 j++)
462 {
463 if ((*i)->GetPeerAid() == (*j)->GetAid())
464 {
465 // I am presented at neighbour's list of neighbors
466 myBeaconExists = true;
467 continue;
468 }
469 if (((int16_t)((*j)->GetLastBeacon() - lastBeaconInTimeElement) >= 0) &&
470 (((*j)->GetLastBeacon() - lastBeaconInTimeElement) %
471 (4 * TimeToTu(beaconInterval->second)) ==
472 0))
473 {
474 ShiftOwnBeacon(interface);
475 return;
476 }
477 }
478 if (!myBeaconExists)
479 {
480 // If I am not present in neighbor's beacon timing element, this may be caused by
481 // collisions with
482 ShiftOwnBeacon(interface);
483 return;
484 }
485 }
486}
487
488void
490{
491 int shift = 0;
492 do
493 {
494 shift = (int)m_beaconShift->GetValue();
495 } while (shift == 0);
496 // Apply beacon shift parameters:
497 PeerManagementProtocolMacMap::iterator plugin = m_plugins.find(interface);
498 NS_ASSERT(plugin != m_plugins.end());
499 plugin->second->SetBeaconShift(TuToTime(shift));
500}
501
502Time
504{
505 return MicroSeconds(x * 1024);
506}
507
508int
510{
511 return (int)(x.GetMicroSeconds() / 1024);
512}
513
514void
516 Mac48Address peerIface,
517 Mac48Address myIface,
518 uint32_t interface)
519{
520 NS_LOG_LOGIC("link_open " << myIface << " " << peerIface);
523 if (!m_peerStatusCallback.IsNull())
524 {
525 m_peerStatusCallback(peerMp, peerIface, interface, true);
526 }
527 m_linkOpenTraceSrc(myIface, peerIface);
528}
529
530void
532 Mac48Address peerIface,
533 Mac48Address myIface,
534 uint32_t interface)
535{
536 NS_LOG_LOGIC("link_close " << myIface << " " << peerIface);
539 if (!m_peerStatusCallback.IsNull())
540 {
541 m_peerStatusCallback(peerMp, peerIface, interface, false);
542 }
543 m_linkCloseTraceSrc(myIface, peerIface);
544}
545
546void
548 Mac48Address peerAddress,
549 Mac48Address peerMeshPointAddress,
550 PeerLink::PeerState ostate,
551 PeerLink::PeerState nstate)
552{
553 PeerManagementProtocolMacMap::iterator plugin = m_plugins.find(interface);
554 NS_ASSERT(plugin != m_plugins.end());
555 NS_LOG_DEBUG("Link between me:" << m_address << " my interface:" << plugin->second->GetAddress()
556 << " and peer mesh point:" << peerMeshPointAddress
557 << " and its interface:" << peerAddress
558 << ", at my interface ID:" << interface << ". State movement:"
559 << PeerLink::PeerStateNames[ostate] << " -> "
560 << PeerLink::PeerStateNames[nstate]);
561 if ((nstate == PeerLink::ESTAB) && (ostate != PeerLink::ESTAB))
562 {
563 NotifyLinkOpen(peerMeshPointAddress, peerAddress, plugin->second->GetAddress(), interface);
564 }
565 if ((ostate == PeerLink::ESTAB) && (nstate != PeerLink::ESTAB))
566 {
567 NotifyLinkClose(peerMeshPointAddress, peerAddress, plugin->second->GetAddress(), interface);
568 }
569 if (nstate == PeerLink::IDLE)
570 {
571 Ptr<PeerLink> link = FindPeerLink(interface, peerAddress);
572 NS_ASSERT(!link);
573 }
574}
575
576uint8_t
578{
579 return m_stats.linksTotal;
580}
581
584{
586 return m_meshId;
587}
588
589void
591{
592 m_meshId = Create<IeMeshId>(s);
593}
594
597{
598 return m_address;
599}
600
601void
603{
604 m_lastBeacon[interface] = Simulator::Now();
605 Simulator::Schedule(beaconInterval - TuToTime(m_maxBeaconShift + 1),
607 this,
608 interface);
609 m_beaconInterval[interface] = beaconInterval;
610}
611
613 : linksTotal(t),
614 linksOpened(0),
615 linksClosed(0)
616{
617}
618
619void
621{
622 os << "<Statistics "
623 "linksTotal=\""
624 << linksTotal
625 << "\" "
626 "linksOpened=\""
627 << linksOpened
628 << "\" "
629 "linksClosed=\""
630 << linksClosed << "\"/>" << std::endl;
631}
632
633void
634PeerManagementProtocol::Report(std::ostream& os) const
635{
636 os << "<PeerManagementProtocol>" << std::endl;
637 m_stats.Print(os);
638 for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin();
639 plugins != m_plugins.end();
640 plugins++)
641 {
642 // Take statistics from plugin:
643 plugins->second->Report(os);
644 // Print all active peer links:
645 PeerLinksMap::const_iterator iface = m_peerLinks.find(plugins->second->m_ifIndex);
646 NS_ASSERT(iface != m_peerLinks.end());
647 for (PeerLinksOnInterface::const_iterator i = iface->second.begin();
648 i != iface->second.end();
649 i++)
650 {
651 (*i)->Report(os);
652 }
653 }
654 os << "</PeerManagementProtocol>" << std::endl;
655}
656
657void
659{
660 m_stats = Statistics(m_stats.linksTotal); // don't reset number of links
661 for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin();
662 plugins != m_plugins.end();
663 plugins++)
664 {
665 plugins->second->ResetStats();
666 }
667}
668
669int64_t
671{
672 NS_LOG_FUNCTION(this << stream);
673 m_beaconShift->SetStream(stream);
674 return 1;
675}
676
677void
679{
680 // If beacon interval is equal to the neighbor's one and one o more beacons received
681 // by my neighbor coincide with my beacon - apply random uniformly distributed shift from
682 // [-m_maxBeaconShift, m_maxBeaconShift] except 0.
685}
686
687void
689{
690 m_enableBca = enable;
691}
692
693bool
695{
696 return m_enableBca;
697}
698} // namespace dot11s
699} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Callback template class.
Definition: callback.h:438
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address GetBroadcast()
Basic MAC of mesh point Wi-Fi interface.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:200
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
Hold an unsigned integer type.
Definition: uinteger.h:45
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
Hold together all Wifi-related objects.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
according to IEEE 802.11 - 2012
bool SubtypeIsOpen() const
Subtype is open function.
bool SubtypeIsClose() const
Subtype is close function.
PmpReasonCode GetReasonCode() const
Get reason code function.
bool SubtypeIsConfirm() const
Subtype is confirm function.
uint16_t GetPeerLinkId() const
Get peer link ID function.
uint16_t GetLocalLinkId() const
Get local link ID function.
802.11s Peer Management Protocol model
void ReceivePeerLinkFrame(uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddress, uint16_t aid, IePeerManagement peerManagementElement, IeConfiguration meshConfig)
Deliver Peer link management information to the protocol-part.
void DoDispose() override
Destructor implementation.
bool GetBeaconCollisionAvoidance() const
Get beacon collision avoidance.
bool ShouldSendOpen(uint32_t interface, Mac48Address peerAddress) const
External peer-chooser.
Callback< void, Mac48Address, Mac48Address, uint32_t, bool > m_peerStatusCallback
Callback to notify about peer link changes: Mac48Address is peer address of mesh point,...
void SetMeshId(std::string s)
Set mesh ID to a string value.
uint8_t m_maxNumberOfPeerLinks
maimum number of peer links
int TimeToTu(Time x)
Time<-->TU converters:
void Report(std::ostream &os) const
Report statistics.
void TransmissionFailure(uint32_t interface, const Mac48Address peerAddress)
Cancels peer link due to successive transmission failures.
uint16_t m_maxBeaconShift
Beacon can be shifted at [-m_maxBeaconShift; +m_maxBeaconShift] TUs.
LinkEventCallback m_linkOpenTraceSrc
LinkOpen trace source.
void TransmissionSuccess(uint32_t interface, const Mac48Address peerAddress)
resets transmission failure statistics
bool ShouldAcceptOpen(uint32_t interface, Mac48Address peerAddress, PmpReasonCode &reasonCode) const
External peer-chooser.
std::vector< Ptr< PeerLink > > GetPeerLinks() const
Get list of all active peer links.
void ReceiveBeacon(uint32_t interface, Mac48Address peerAddress, Time beaconInterval, Ptr< IeBeaconTiming > beaconTiming)
To initiate peer link we must notify about received beacon.
void NotifyLinkClose(Mac48Address peerMp, Mac48Address peerIface, Mac48Address myIface, uint32_t interface)
Aux.
Ptr< PeerLink > InitiateLink(uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddress)
Initiate link function.
void DoInitialize() override
Initialize() implementation.
Ptr< IeMeshId > GetMeshId() const
Get mesh ID information element.
void SetPeerLinkStatusCallback(Callback< void, Mac48Address, Mac48Address, uint32_t, bool > cb)
Set peer link status change callback.
uint8_t GetNumberOfLinks() const
Get number of links.
static TypeId GetTypeId()
Get the type ID.
std::map< uint32_t, Time > m_lastBeacon
Last beacon at each interface.
bool Install(Ptr< MeshPointDevice > mp)
Install PMP on given mesh point.
PeerManagementProtocolMacMap m_plugins
plugins
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
std::map< uint32_t, Time > m_beaconInterval
Beacon interval at each interface.
void NotifyBeaconSent(uint32_t interface, Time beaconInterval)
Notify about beacon send event, needed to schedule BCA.
void ShiftOwnBeacon(uint32_t interface)
Shift own beacon function.
std::vector< Ptr< PeerLink > > PeerLinksOnInterface
We keep a vector of pointers to PeerLink class.
void ConfigurationMismatch(uint32_t interface, Mac48Address peerAddress)
Cancels peer link due to broken configuration (Mesh ID or Supported rates)
PeerLinksMap m_peerLinks
Simple link open/close trace source type. Addresses are: src interface, dst interface.
Ptr< UniformRandomVariable > m_beaconShift
Add randomness to beacon shift.
void PeerLinkStatus(uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddress, PeerLink::PeerState ostate, PeerLink::PeerState nstate)
Indicates changes in peer links.
bool IsActiveLink(uint32_t interface, Mac48Address peerAddress)
Checks if there is established link.
std::vector< Mac48Address > GetPeers(uint32_t interface) const
Get list of active peers of my given interface.
LinkEventCallback m_linkCloseTraceSrc
LinkClose trace source.
void CheckBeaconCollisions(uint32_t interface)
BCA.
Ptr< IeBeaconTiming > GetBeaconTimingElement(uint32_t interface)
When we are sending a beacon - we fill beacon timing element.
Mac48Address GetAddress()
Get mesh point address.
Ptr< PeerLink > FindPeerLink(uint32_t interface, Mac48Address peerAddress)
Find active peer link by my interface and peer interface MAC.
Time TuToTime(int x)
Time<-->TU converters:
uint16_t m_lastLocalLinkId
last local link ID
void NotifyLinkOpen(Mac48Address peerMp, Mac48Address peerIface, Mac48Address myIface, uint32_t interface)
Aux.
void ResetStats()
Reset statistics function.
void SetBeaconCollisionAvoidance(bool enable)
Enable or disable beacon collision avoidance.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
PmpReasonCode
Codes used by 802.11s Peer Management Protocol.
std::vector< Ptr< IeBeaconTimingUnit > > NeighboursTimingUnitsList
This type is a list of timing elements obtained from neighbours with their beacons:
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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.
Definition: object-base.h:46
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1360
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:488
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...
Definition: callback.h:702
void Print(std::ostream &os) const
Print function.