A Discrete-Event Network Simulator
API
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 
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 
37 namespace ns3
38 {
39 
40 NS_LOG_COMPONENT_DEFINE("PeerManagementProtocol");
41 
42 namespace dot11s
43 {
44 
45 /***************************************************
46  * PeerManager
47  ***************************************************/
48 NS_OBJECT_ENSURE_REGISTERED(PeerManagementProtocol);
49 
50 TypeId
52 {
53  static TypeId tid =
54  TypeId("ns3::dot11s::PeerManagementProtocol")
55  .SetParent<Object>()
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 
103 void
105 {
106  // cancel cleanup event and go through the map of peer links,
107  // deleting each
108  for (auto j = m_peerLinks.begin(); j != m_peerLinks.end(); j++)
109  {
110  for (auto 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 
120 bool
122 {
123  std::vector<Ptr<NetDevice>> interfaces = mp->GetInterfaces();
124  for (auto i = interfaces.begin(); i != interfaces.end(); i++)
125  {
126  Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice>();
127  if (!wifiNetDev)
128  {
129  return false;
130  }
132  if (!mac)
133  {
134  return false;
135  }
137  Create<PeerManagementProtocolMac>((*i)->GetIfIndex(), this);
138  mac->InstallPlugin(plugin);
139  m_plugins[(*i)->GetIfIndex()] = plugin;
140  PeerLinksOnInterface newmap;
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  auto iface = m_peerLinks.find(interface);
158  NS_ASSERT(iface != m_peerLinks.end());
159  for (auto 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 
175 void
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 (auto i = m_plugins.begin(); i != m_plugins.end(); i++)
184  {
185  if (i->second->GetAddress() == peerAddress)
186  {
187  return;
188  }
189  }
190  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
191  if (!peerLink)
192  {
193  if (ShouldSendOpen(interface, peerAddress))
194  {
195  peerLink = InitiateLink(interface, peerAddress, Mac48Address::GetBroadcast());
196  peerLink->MLMEActivePeerLinkOpen();
197  }
198  else
199  {
200  return;
201  }
202  }
203  peerLink->SetBeaconInformation(Simulator::Now(), beaconInterval);
205  {
206  peerLink->SetBeaconTimingElement(*PeekPointer(timingElement));
207  }
208 }
209 
210 void
212  Mac48Address peerAddress,
213  Mac48Address peerMeshPointAddress,
214  uint16_t aid,
215  IePeerManagement peerManagementElement,
216  IeConfiguration meshConfig)
217 {
218  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
219  if (peerManagementElement.SubtypeIsOpen())
220  {
221  PmpReasonCode reasonCode(REASON11S_RESERVED);
222  bool reject = !(ShouldAcceptOpen(interface, peerAddress, reasonCode));
223  if (!peerLink)
224  {
225  peerLink = InitiateLink(interface, peerAddress, peerMeshPointAddress);
226  }
227  if (!reject)
228  {
229  peerLink->OpenAccept(peerManagementElement.GetLocalLinkId(),
230  meshConfig,
231  peerMeshPointAddress);
232  }
233  else
234  {
235  peerLink->OpenReject(peerManagementElement.GetLocalLinkId(),
236  meshConfig,
237  peerMeshPointAddress,
238  reasonCode);
239  }
240  }
241  if (!peerLink)
242  {
243  return;
244  }
245  if (peerManagementElement.SubtypeIsConfirm())
246  {
247  peerLink->ConfirmAccept(peerManagementElement.GetLocalLinkId(),
248  peerManagementElement.GetPeerLinkId(),
249  aid,
250  meshConfig,
251  peerMeshPointAddress);
252  }
253  if (peerManagementElement.SubtypeIsClose())
254  {
255  peerLink->Close(peerManagementElement.GetLocalLinkId(),
256  peerManagementElement.GetPeerLinkId(),
257  peerManagementElement.GetReasonCode());
258  }
259 }
260 
261 void
263 {
264  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
265  if (peerLink)
266  {
267  peerLink->MLMECancelPeerLink(REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
268  }
269 }
270 
271 void
273 {
274  NS_LOG_DEBUG("transmission failed between " << GetAddress() << " and " << peerAddress
275  << " failed, link will be closed");
276  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
277  if (peerLink)
278  {
279  peerLink->TransmissionFailure();
280  }
281 }
282 
283 void
285 {
286  NS_LOG_DEBUG("transmission success " << GetAddress() << " and " << peerAddress);
287  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
288  if (peerLink)
289  {
290  peerLink->TransmissionSuccess();
291  }
292 }
293 
296  Mac48Address peerAddress,
297  Mac48Address peerMeshPointAddress)
298 {
299  Ptr<PeerLink> new_link = CreateObject<PeerLink>();
300  // find a peer link - it must not exist
301  if (FindPeerLink(interface, peerAddress))
302  {
303  NS_FATAL_ERROR("Peer link must not exist.");
304  }
305  // Plugin must exist
306  auto plugin = m_plugins.find(interface);
307  NS_ASSERT(plugin != m_plugins.end());
308  auto iface = m_peerLinks.find(interface);
309  NS_ASSERT(iface != m_peerLinks.end());
310  new_link->SetLocalAid(m_lastAssocId++);
311  new_link->SetInterface(interface);
312  new_link->SetLocalLinkId(m_lastLocalLinkId++);
313  new_link->SetPeerAddress(peerAddress);
314  new_link->SetPeerMeshPointAddress(peerMeshPointAddress);
315  new_link->SetMacPlugin(plugin->second);
316  new_link->MLMESetSignalStatusCallback(
318  iface->second.push_back(new_link);
319  return new_link;
320 }
321 
323 PeerManagementProtocol::FindPeerLink(uint32_t interface, Mac48Address peerAddress)
324 {
325  auto iface = m_peerLinks.find(interface);
326  NS_ASSERT(iface != m_peerLinks.end());
327  for (auto i = iface->second.begin(); i != iface->second.end(); i++)
328  {
329  if ((*i)->GetPeerAddress() == peerAddress)
330  {
331  if ((*i)->LinkIsIdle())
332  {
333  (*i) = nullptr;
334  (iface->second).erase(i);
335  return nullptr;
336  }
337  else
338  {
339  return *i;
340  }
341  }
342  }
343  return nullptr;
344 }
345 
346 void
349 {
351 }
352 
353 std::vector<Mac48Address>
354 PeerManagementProtocol::GetPeers(uint32_t interface) const
355 {
356  std::vector<Mac48Address> retval;
357  auto iface = m_peerLinks.find(interface);
358  NS_ASSERT(iface != m_peerLinks.end());
359  for (auto i = iface->second.begin(); i != iface->second.end(); i++)
360  {
361  if ((*i)->LinkIsEstab())
362  {
363  retval.push_back((*i)->GetPeerAddress());
364  }
365  }
366  return retval;
367 }
368 
369 std::vector<Ptr<PeerLink>>
371 {
372  std::vector<Ptr<PeerLink>> links;
373 
374  for (auto iface = m_peerLinks.begin(); iface != m_peerLinks.end(); ++iface)
375  {
376  for (auto i = iface->second.begin(); i != iface->second.end(); i++)
377  {
378  if ((*i)->LinkIsEstab())
379  {
380  links.push_back(*i);
381  }
382  }
383  }
384  return links;
385 }
386 
387 bool
388 PeerManagementProtocol::IsActiveLink(uint32_t interface, Mac48Address peerAddress)
389 {
390  Ptr<PeerLink> peerLink = FindPeerLink(interface, peerAddress);
391  if (peerLink)
392  {
393  return peerLink->LinkIsEstab();
394  }
395  return false;
396 }
397 
398 bool
399 PeerManagementProtocol::ShouldSendOpen(uint32_t interface, Mac48Address peerAddress) const
400 {
402 }
403 
404 bool
406  Mac48Address peerAddress,
407  PmpReasonCode& reasonCode) const
408 {
410  {
411  reasonCode = REASON11S_MESH_MAX_PEERS;
412  return false;
413  }
414  return true;
415 }
416 
417 void
419 {
421  {
422  return;
423  }
424  auto iface = m_peerLinks.find(interface);
425  NS_ASSERT(iface != m_peerLinks.end());
426  NS_ASSERT(m_plugins.find(interface) != m_plugins.end());
427 
428  auto lastBeacon = m_lastBeacon.find(interface);
429  auto beaconInterval = m_beaconInterval.find(interface);
430  if ((lastBeacon == m_lastBeacon.end()) || (beaconInterval == m_beaconInterval.end()))
431  {
432  return;
433  }
434  // my last beacon in 256 us units
435  auto lastBeaconInTimeElement = (uint16_t)((lastBeacon->second.GetMicroSeconds() >> 8) & 0xffff);
436 
438  "Wrong beacon shift parameters");
439 
440  if (iface->second.empty())
441  {
442  // I have no peers - may be our beacons are in collision
443  ShiftOwnBeacon(interface);
444  return;
445  }
446  // check whether all my peers receive my beacon and I'am not in collision with other beacons
447 
448  for (auto i = iface->second.begin(); i != iface->second.end(); i++)
449  {
450  bool myBeaconExists = false;
452  (*i)->GetBeaconTimingElement().GetNeighboursTimingElementsList();
453  for (auto j = neighbors.begin(); j != neighbors.end(); j++)
454  {
455  if ((*i)->GetPeerAid() == (*j)->GetAid())
456  {
457  // I am presented at neighbour's list of neighbors
458  myBeaconExists = true;
459  continue;
460  }
461  if (((int16_t)((*j)->GetLastBeacon() - lastBeaconInTimeElement) >= 0) &&
462  (((*j)->GetLastBeacon() - lastBeaconInTimeElement) %
463  (4 * TimeToTu(beaconInterval->second)) ==
464  0))
465  {
466  ShiftOwnBeacon(interface);
467  return;
468  }
469  }
470  if (!myBeaconExists)
471  {
472  // If I am not present in neighbor's beacon timing element, this may be caused by
473  // collisions with
474  ShiftOwnBeacon(interface);
475  return;
476  }
477  }
478 }
479 
480 void
482 {
483  int shift = 0;
484  do
485  {
486  shift = (int)m_beaconShift->GetValue();
487  } while (shift == 0);
488  // Apply beacon shift parameters:
489  auto plugin = m_plugins.find(interface);
490  NS_ASSERT(plugin != m_plugins.end());
491  plugin->second->SetBeaconShift(TuToTime(shift));
492 }
493 
494 Time
496 {
497  return MicroSeconds(x * 1024);
498 }
499 
500 int
502 {
503  return (int)(x.GetMicroSeconds() / 1024);
504 }
505 
506 void
508  Mac48Address peerIface,
509  Mac48Address myIface,
510  uint32_t interface)
511 {
512  NS_LOG_LOGIC("link_open " << myIface << " " << peerIface);
515  if (!m_peerStatusCallback.IsNull())
516  {
517  m_peerStatusCallback(peerMp, peerIface, interface, true);
518  }
519  m_linkOpenTraceSrc(myIface, peerIface);
520 }
521 
522 void
524  Mac48Address peerIface,
525  Mac48Address myIface,
526  uint32_t interface)
527 {
528  NS_LOG_LOGIC("link_close " << myIface << " " << peerIface);
531  if (!m_peerStatusCallback.IsNull())
532  {
533  m_peerStatusCallback(peerMp, peerIface, interface, false);
534  }
535  m_linkCloseTraceSrc(myIface, peerIface);
536 }
537 
538 void
540  Mac48Address peerAddress,
541  Mac48Address peerMeshPointAddress,
542  PeerLink::PeerState ostate,
543  PeerLink::PeerState nstate)
544 {
545  auto plugin = m_plugins.find(interface);
546  NS_ASSERT(plugin != m_plugins.end());
547  NS_LOG_DEBUG("Link between me:" << m_address << " my interface:" << plugin->second->GetAddress()
548  << " and peer mesh point:" << peerMeshPointAddress
549  << " and its interface:" << peerAddress
550  << ", at my interface ID:" << interface << ". State movement:"
551  << PeerLink::PeerStateNames[ostate] << " -> "
552  << PeerLink::PeerStateNames[nstate]);
553  if ((nstate == PeerLink::ESTAB) && (ostate != PeerLink::ESTAB))
554  {
555  NotifyLinkOpen(peerMeshPointAddress, peerAddress, plugin->second->GetAddress(), interface);
556  }
557  if ((ostate == PeerLink::ESTAB) && (nstate != PeerLink::ESTAB))
558  {
559  NotifyLinkClose(peerMeshPointAddress, peerAddress, plugin->second->GetAddress(), interface);
560  }
561  if (nstate == PeerLink::IDLE)
562  {
563  Ptr<PeerLink> link = FindPeerLink(interface, peerAddress);
564  NS_ASSERT(!link);
565  }
566 }
567 
568 uint8_t
570 {
571  return m_stats.linksTotal;
572 }
573 
576 {
578  return m_meshId;
579 }
580 
581 void
583 {
584  m_meshId = Create<IeMeshId>(s);
585 }
586 
589 {
590  return m_address;
591 }
592 
593 void
594 PeerManagementProtocol::NotifyBeaconSent(uint32_t interface, Time beaconInterval)
595 {
596  m_lastBeacon[interface] = Simulator::Now();
597  Simulator::Schedule(beaconInterval - TuToTime(m_maxBeaconShift + 1),
599  this,
600  interface);
601  m_beaconInterval[interface] = beaconInterval;
602 }
603 
605  : linksTotal(t),
606  linksOpened(0),
607  linksClosed(0)
608 {
609 }
610 
611 void
613 {
614  os << "<Statistics "
615  "linksTotal=\""
616  << linksTotal
617  << "\" "
618  "linksOpened=\""
619  << linksOpened
620  << "\" "
621  "linksClosed=\""
622  << linksClosed << "\"/>" << std::endl;
623 }
624 
625 void
626 PeerManagementProtocol::Report(std::ostream& os) const
627 {
628  os << "<PeerManagementProtocol>" << std::endl;
629  m_stats.Print(os);
630  for (auto plugins = m_plugins.begin(); plugins != m_plugins.end(); plugins++)
631  {
632  // Take statistics from plugin:
633  plugins->second->Report(os);
634  // Print all active peer links:
635  auto iface = m_peerLinks.find(plugins->second->m_ifIndex);
636  NS_ASSERT(iface != m_peerLinks.end());
637  for (auto i = iface->second.begin(); i != iface->second.end(); i++)
638  {
639  (*i)->Report(os);
640  }
641  }
642  os << "</PeerManagementProtocol>" << std::endl;
643 }
644 
645 void
647 {
648  m_stats = Statistics(m_stats.linksTotal); // don't reset number of links
649  for (auto plugins = m_plugins.begin(); plugins != m_plugins.end(); plugins++)
650  {
651  plugins->second->ResetStats();
652  }
653 }
654 
655 int64_t
657 {
658  NS_LOG_FUNCTION(this << stream);
659  m_beaconShift->SetStream(stream);
660  return 1;
661 }
662 
663 void
665 {
666  // If beacon interval is equal to the neighbor's one and one o more beacons received
667  // by my neighbor coincide with my beacon - apply random uniformly distributed shift from
668  // [-m_maxBeaconShift, m_maxBeaconShift] except 0.
671 }
672 
673 void
675 {
676  m_enableBca = enable;
677 }
678 
679 bool
681 {
682  return m_enableBca;
683 }
684 } // namespace dot11s
685 } // namespace ns3
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:204
A base class which provides memory management and object aggregation.
Definition: object.h:89
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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:571
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
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:931
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.
Ptr< WifiMac > GetMac() const
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
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:1350
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
interfaces
Definition: first.py:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
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:704
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:449
mac
Definition: third.py:92
list plugins
Definition: base.py:100
void Print(std::ostream &os) const
Print function.