A Discrete-Event Network Simulator
API
peer-management-protocol.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2008,2009 IITP RAS
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Kirill Andreev <andreev@iitp.ru>
19 * Aleksey Kovalenko <kovalenko@iitp.ru>
20 */
21
22#include "ns3/peer-management-protocol.h"
25#include "ie-dot11s-id.h"
26#include "ns3/mesh-point-device.h"
27#include "ns3/simulator.h"
28#include "ns3/assert.h"
29#include "ns3/log.h"
30#include "ns3/random-variable-stream.h"
31#include "ns3/mesh-wifi-interface-mac.h"
32#include "ns3/mesh-wifi-interface-mac-plugin.h"
33#include "ns3/wifi-net-device.h"
34#include "ns3/trace-source-accessor.h"
35
36namespace ns3 {
37
38NS_LOG_COMPONENT_DEFINE ("PeerManagementProtocol");
39
40namespace dot11s {
41
42/***************************************************
43 * PeerManager
44 ***************************************************/
45NS_OBJECT_ENSURE_REGISTERED (PeerManagementProtocol);
46
47TypeId
49{
50 static TypeId tid = TypeId ("ns3::dot11s::PeerManagementProtocol")
51 .SetParent<Object> ()
52 .SetGroupName ("Mesh")
53 .AddConstructor<PeerManagementProtocol> ()
54 // maximum number of peer links. Now we calculate the total
55 // number of peer links on all interfaces
56 .AddAttribute ( "MaxNumberOfPeerLinks",
57 "Maximum number of peer links",
58 UintegerValue (32),
61 MakeUintegerChecker<uint8_t> ()
62 )
63 .AddAttribute ( "MaxBeaconShiftValue",
64 "Maximum number of TUs for beacon shifting",
65 UintegerValue (15),
68 MakeUintegerChecker<uint16_t> ()
69 )
70 .AddAttribute ( "EnableBeaconCollisionAvoidance",
71 "Enable/Disable Beacon collision avoidance.",
72 BooleanValue (true),
76 )
77 .AddTraceSource ("LinkOpen",
78 "New peer link opened",
80 "ns3::PeerManagementProtocol::LinkOpenCloseTracedCallback"
81 )
82 .AddTraceSource ("LinkClose",
83 "New peer link closed",
85 "ns3::PeerManagementProtocol::LinkOpenCloseTracedCallback"
86 )
87
88 ;
89 return tid;
90}
92 m_lastAssocId (0), m_lastLocalLinkId (1), m_enableBca (true), m_maxBeaconShift (15)
93{
94 m_beaconShift = CreateObject<UniformRandomVariable> ();
95}
97{
98 m_meshId = 0;
99}
100void
102{
103 //cancel cleanup event and go through the map of peer links,
104 //deleting each
105 for (PeerLinksMap::iterator j = m_peerLinks.begin (); j != m_peerLinks.end (); j++)
106 {
107 for (PeerLinksOnInterface::iterator i = j->second.begin (); i != j->second.end (); i++)
108 {
109 (*i) = 0;
110 }
111 j->second.clear ();
112 }
113 m_peerLinks.clear ();
114 m_plugins.clear ();
115}
116
117bool
119{
120 std::vector<Ptr<NetDevice> > interfaces = mp->GetInterfaces ();
121 for (std::vector<Ptr<NetDevice> >::iterator i = interfaces.begin (); i != interfaces.end (); i++)
122 {
123 Ptr<WifiNetDevice> wifiNetDev = (*i)->GetObject<WifiNetDevice> ();
124 if (wifiNetDev == 0)
125 {
126 return false;
127 }
128 Ptr<MeshWifiInterfaceMac> mac = wifiNetDev->GetMac ()->GetObject<MeshWifiInterfaceMac> ();
129 if (mac == 0)
130 {
131 return false;
132 }
133 Ptr<PeerManagementProtocolMac> plugin = Create<PeerManagementProtocolMac> ((*i)->GetIfIndex (), this);
134 mac->InstallPlugin (plugin);
135 m_plugins[(*i)->GetIfIndex ()] = plugin;
137 m_peerLinks[(*i)->GetIfIndex ()] = newmap;
138 }
139 // Mesh point aggregates all installed protocols
140 m_address = Mac48Address::ConvertFrom (mp->GetAddress ());
141 mp->AggregateObject (this);
142 return true;
143}
144
147{
149 {
150 return 0;
151 }
152 Ptr<IeBeaconTiming> retval = Create<IeBeaconTiming> ();
153 PeerLinksMap::iterator iface = m_peerLinks.find (interface);
154 NS_ASSERT (iface != m_peerLinks.end ());
155 for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
156 {
157 //If we do not know peer Assoc Id, we shall not add any info
158 //to a beacon timing element
159 if ((*i)->GetBeaconInterval () == Seconds (0))
160 {
161 //No beacon was received, do not include to the beacon timing element
162 continue;
163 }
164 retval->AddNeighboursTimingElementUnit ((*i)->GetLocalAid (), (*i)->GetLastBeacon (),
165 (*i)->GetBeaconInterval ());
166 }
167 return retval;
168}
169void
170PeerManagementProtocol::ReceiveBeacon (uint32_t interface, Mac48Address peerAddress, Time beaconInterval, Ptr<IeBeaconTiming> timingElement)
171{
172 //PM STATE Machine
173 //Check that a given beacon is not from our interface
174 for (PeerManagementProtocolMacMap::const_iterator i = m_plugins.begin (); i != m_plugins.end (); i++)
175 {
176 if (i->second->GetAddress () == peerAddress)
177 {
178 return;
179 }
180 }
181 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
182 if (peerLink == 0)
183 {
184 if (ShouldSendOpen (interface, peerAddress))
185 {
186 peerLink = InitiateLink (interface, peerAddress, Mac48Address::GetBroadcast ());
187 peerLink->MLMEActivePeerLinkOpen ();
188 }
189 else
190 {
191 return;
192 }
193 }
194 peerLink->SetBeaconInformation (Simulator::Now (), beaconInterval);
196 {
197 peerLink->SetBeaconTimingElement (*PeekPointer (timingElement));
198 }
199}
200
201void
203 Mac48Address peerMeshPointAddress, uint16_t aid, IePeerManagement peerManagementElement,
204 IeConfiguration meshConfig)
205{
206 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
207 if (peerManagementElement.SubtypeIsOpen ())
208 {
210 bool reject = !(ShouldAcceptOpen (interface, peerAddress, reasonCode));
211 if (peerLink == 0)
212 {
213 peerLink = InitiateLink (interface, peerAddress, peerMeshPointAddress);
214 }
215 if (!reject)
216 {
217 peerLink->OpenAccept (peerManagementElement.GetLocalLinkId (), meshConfig, peerMeshPointAddress);
218 }
219 else
220 {
221 peerLink->OpenReject (peerManagementElement.GetLocalLinkId (), meshConfig, peerMeshPointAddress,
222 reasonCode);
223 }
224 }
225 if (peerLink == 0)
226 {
227 return;
228 }
229 if (peerManagementElement.SubtypeIsConfirm ())
230 {
231 peerLink->ConfirmAccept (peerManagementElement.GetLocalLinkId (),
232 peerManagementElement.GetPeerLinkId (), aid, meshConfig, peerMeshPointAddress);
233 }
234 if (peerManagementElement.SubtypeIsClose ())
235 {
236 peerLink->Close (peerManagementElement.GetLocalLinkId (), peerManagementElement.GetPeerLinkId (),
237 peerManagementElement.GetReasonCode ());
238 }
239}
240void
242{
243 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
244 if (peerLink != 0)
245 {
246 peerLink->MLMECancelPeerLink (REASON11S_MESH_CAPABILITY_POLICY_VIOLATION);
247 }
248}
249void
251{
252 NS_LOG_DEBUG ("transmission failed between "<<GetAddress () << " and " << peerAddress << " failed, link will be closed");
253 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
254 if (peerLink != 0)
255 {
256 peerLink->TransmissionFailure ();
257 }
258}
259void
261{
262 NS_LOG_DEBUG ("transmission success "<< GetAddress () << " and " << peerAddress);
263 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
264 if (peerLink != 0)
265 {
266 peerLink->TransmissionSuccess ();
267 }
268}
271 Mac48Address peerMeshPointAddress)
272{
273 Ptr<PeerLink> new_link = CreateObject<PeerLink> ();
274 //find a peer link - it must not exist
275 if (FindPeerLink (interface, peerAddress) != 0)
276 {
277 NS_FATAL_ERROR ("Peer link must not exist.");
278 }
279 // Plugin must exist
280 PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
281 NS_ASSERT (plugin != m_plugins.end ());
282 PeerLinksMap::iterator iface = m_peerLinks.find (interface);
283 NS_ASSERT (iface != m_peerLinks.end ());
284 new_link->SetLocalAid (m_lastAssocId++);
285 new_link->SetInterface (interface);
286 new_link->SetLocalLinkId (m_lastLocalLinkId++);
287 new_link->SetPeerAddress (peerAddress);
288 new_link->SetPeerMeshPointAddress (peerMeshPointAddress);
289 new_link->SetMacPlugin (plugin->second);
290 new_link->MLMESetSignalStatusCallback (MakeCallback (&PeerManagementProtocol::PeerLinkStatus, this));
291 iface->second.push_back (new_link);
292 return new_link;
293}
294
297{
298 PeerLinksMap::iterator iface = m_peerLinks.find (interface);
299 NS_ASSERT (iface != m_peerLinks.end ());
300 for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
301 {
302 if ((*i)->GetPeerAddress () == peerAddress)
303 {
304 if ((*i)->LinkIsIdle ())
305 {
306 (*i) = 0;
307 (iface->second).erase (i);
308 return 0;
309 }
310 else
311 {
312 return (*i);
313 }
314 }
315 }
316 return 0;
317}
318void
321{
323}
324
325std::vector<Mac48Address>
327{
328 std::vector<Mac48Address> retval;
329 PeerLinksMap::const_iterator iface = m_peerLinks.find (interface);
330 NS_ASSERT (iface != m_peerLinks.end ());
331 for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); i != iface->second.end (); i++)
332 {
333 if ((*i)->LinkIsEstab ())
334 {
335 retval.push_back ((*i)->GetPeerAddress ());
336 }
337 }
338 return retval;
339}
340
341std::vector< Ptr<PeerLink> >
343{
344 std::vector< Ptr<PeerLink> > links;
345
346 for (PeerLinksMap::const_iterator iface = m_peerLinks.begin (); iface != m_peerLinks.end (); ++iface)
347 {
348 for (PeerLinksOnInterface::const_iterator i = iface->second.begin ();
349 i != iface->second.end (); i++)
350 if ((*i)->LinkIsEstab ())
351 links.push_back (*i);
352 }
353 return links;
354}
355bool
357{
358 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
359 if (peerLink != 0)
360 {
361 return (peerLink->LinkIsEstab ());
362 }
363 return false;
364}
365bool
367{
369}
370
371bool
373 PmpReasonCode & reasonCode)
374{
376 {
377 reasonCode = REASON11S_MESH_MAX_PEERS;
378 return false;
379 }
380 return true;
381}
382
383void
385{
387 {
388 return;
389 }
390 PeerLinksMap::iterator iface = m_peerLinks.find (interface);
391 NS_ASSERT (iface != m_peerLinks.end ());
392 NS_ASSERT (m_plugins.find (interface) != m_plugins.end ());
393
394 std::map<uint32_t, Time>::const_iterator lastBeacon = m_lastBeacon.find (interface);
395 std::map<uint32_t, Time>::const_iterator beaconInterval = m_beaconInterval.find (interface);
396 if ((lastBeacon == m_lastBeacon.end ()) || (beaconInterval == m_beaconInterval.end ()))
397 {
398 return;
399 }
400 //my last beacon in 256 us units
401 uint16_t lastBeaconInTimeElement = (uint16_t) ((lastBeacon->second.GetMicroSeconds () >> 8) & 0xffff);
402
403 NS_ASSERT_MSG (TuToTime (m_maxBeaconShift) <= m_beaconInterval[interface], "Wrong beacon shift parameters");
404
405 if (iface->second.size () == 0)
406 {
407 //I have no peers - may be our beacons are in collision
408 ShiftOwnBeacon (interface);
409 return;
410 }
411 //check whether all my peers receive my beacon and I'am not in collision with other beacons
412
413 for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
414 {
415 bool myBeaconExists = false;
416 IeBeaconTiming::NeighboursTimingUnitsList neighbors = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList ();
417 for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbors.begin (); j != neighbors.end (); j++)
418 {
419 if ((*i)->GetPeerAid () == (*j)->GetAid ())
420 {
421 // I am presented at neighbour's list of neighbors
422 myBeaconExists = true;
423 continue;
424 }
425 if (
426 ((int16_t) ((*j)->GetLastBeacon () - lastBeaconInTimeElement) >= 0) &&
427 (((*j)->GetLastBeacon () - lastBeaconInTimeElement) % (4 * TimeToTu (beaconInterval->second)) == 0)
428 )
429 {
430 ShiftOwnBeacon (interface);
431 return;
432 }
433 }
434 if (!myBeaconExists)
435 {
436 // If I am not present in neighbor's beacon timing element, this may be caused by collisions with
437 ShiftOwnBeacon (interface);
438 return;
439 }
440 }
441}
442
443void
445{
446 int shift = 0;
447 do
448 {
449 shift = (int) m_beaconShift->GetValue ();
450 }
451 while (shift == 0);
452 // Apply beacon shift parameters:
453 PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
454 NS_ASSERT (plugin != m_plugins.end ());
455 plugin->second->SetBeaconShift (TuToTime (shift));
456}
457
458Time
460{
461 return MicroSeconds (x * 1024);
462}
463int
465{
466 return (int)(x.GetMicroSeconds () / 1024);
467}
468
469void
471{
472 NS_LOG_LOGIC ("link_open " << myIface << " " << peerIface);
475 if (!m_peerStatusCallback.IsNull ())
476 {
477 m_peerStatusCallback (peerMp, peerIface, interface, true);
478 }
479 m_linkOpenTraceSrc (myIface, peerIface);
480}
481
482void
484{
485 NS_LOG_LOGIC ("link_close " << myIface << " " << peerIface);
488 if (!m_peerStatusCallback.IsNull ())
489 {
490 m_peerStatusCallback (peerMp, peerIface, interface, false);
491 }
492 m_linkCloseTraceSrc (myIface, peerIface);
493}
494
495void
497 Mac48Address peerMeshPointAddress, PeerLink::PeerState ostate, PeerLink::PeerState nstate)
498{
499 PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
500 NS_ASSERT (plugin != m_plugins.end ());
501 NS_LOG_DEBUG ("Link between me:" << m_address << " my interface:"
502 << plugin->second->GetAddress ()
503 << " and peer mesh point:" << peerMeshPointAddress << " and its interface:" << peerAddress
504 << ", at my interface ID:" << interface << ". State movement:" << PeerLink::PeerStateNames[ostate]
505 << " -> " << PeerLink::PeerStateNames[nstate]);
506 if ((nstate == PeerLink::ESTAB) && (ostate != PeerLink::ESTAB))
507 {
508 NotifyLinkOpen (peerMeshPointAddress, peerAddress, plugin->second->GetAddress (), interface);
509 }
510 if ((ostate == PeerLink::ESTAB) && (nstate != PeerLink::ESTAB))
511 {
512 NotifyLinkClose (peerMeshPointAddress, peerAddress, plugin->second->GetAddress (), interface);
513 }
514 if (nstate == PeerLink::IDLE)
515 {
516 Ptr<PeerLink> link = FindPeerLink (interface, peerAddress);
517 NS_ASSERT (link == 0);
518 }
519}
520uint8_t
522{
523 return m_stats.linksTotal;
524}
527{
528 NS_ASSERT (m_meshId != 0);
529 return m_meshId;
530}
531void
533{
534 m_meshId = Create<IeMeshId> (s);
535}
538{
539 return m_address;
540}
541void
543{
544 m_lastBeacon[interface] = Simulator::Now ();
546 m_beaconInterval[interface] = beaconInterval;
547}
549 linksTotal (t), linksOpened (0), linksClosed (0)
550{
551}
552void
554{
555 os << "<Statistics "
556 "linksTotal=\"" << linksTotal << "\" "
557 "linksOpened=\"" << linksOpened << "\" "
558 "linksClosed=\"" << linksClosed << "\"/>" << std::endl;
559}
560void
561PeerManagementProtocol::Report (std::ostream & os) const
562{
563 os << "<PeerManagementProtocol>" << std::endl;
564 m_stats.Print (os);
565 for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins++)
566 {
567 //Take statistics from plugin:
568 plugins->second->Report (os);
569 //Print all active peer links:
570 PeerLinksMap::const_iterator iface = m_peerLinks.find (plugins->second->m_ifIndex);
571 NS_ASSERT (iface != m_peerLinks.end ());
572 for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); i != iface->second.end (); i++)
573 {
574 (*i)->Report (os);
575 }
576 }
577 os << "</PeerManagementProtocol>" << std::endl;
578}
579void
581{
582 m_stats = Statistics (m_stats.linksTotal); // don't reset number of links
583 for (PeerManagementProtocolMacMap::const_iterator plugins = m_plugins.begin (); plugins != m_plugins.end (); plugins++)
584 {
585 plugins->second->ResetStats ();
586 }
587}
588
589int64_t
591{
592 NS_LOG_FUNCTION (this << stream);
593 m_beaconShift->SetStream (stream);
594 return 1;
595}
596
597void
599{
600 // If beacon interval is equal to the neighbor's one and one o more beacons received
601 // by my neighbor coincide with my beacon - apply random uniformly distributed shift from
602 // [-m_maxBeaconShift, m_maxBeaconShift] except 0.
605}
606
607void
609{
610 m_enableBca = enable;
611}
612bool
614{
615 return m_enableBca;
616}
617} // namespace dot11s
618} // namespace ns3
619
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Callback template class.
Definition: callback.h:1279
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
an EUI-48 address
Definition: mac48-address.h:44
static Mac48Address GetBroadcast(void)
static Mac48Address ConvertFrom(const Address &address)
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:256
A base class which provides memory management and object aggregation.
Definition: object.h:88
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Hold an unsigned integer type.
Definition: uinteger.h:44
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Hold together all Wifi-related objects.
Ptr< WifiMac > GetMac(void) 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.
bool GetBeaconCollisionAvoidance() const
Get beacon collision avoidance.
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)
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.
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.
static TypeId GetTypeId()
Get the type ID.
void DoDispose()
Destructor implementation.
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)
uint8_t GetNumberOfLinks()
Get number of links.
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.
virtual void DoInitialize()
Initialize() implementation.
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.
bool ShouldSendOpen(uint32_t interface, Mac48Address peerAddress)
External peer-chooser.
void PeerLinkStatus(uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddres, PeerLink::PeerState ostate, PeerLink::PeerState nstate)
Indicates changes in peer links.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#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:88
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:45
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:165
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#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:45
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1260
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
interfaces
Definition: first.py:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:415
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1648
list x
Random number samples.
mac
Definition: third.py:96
list plugins
Definition: base.py:100
void Print(std::ostream &os) const
Print function.