1.1 --- a/src/devices/mesh/dot11s/airtime-metric.cc Wed Oct 21 17:19:03 2009 -0700
1.2 +++ b/src/devices/mesh/dot11s/airtime-metric.cc Fri Oct 23 15:34:14 2009 +0400
1.3 @@ -31,7 +31,7 @@
1.4 .SetParent<Object> ()
1.5 .AddConstructor<AirtimeLinkMetricCalculator> ()
1.6 .AddAttribute ( "OverheadNanosec",
1.7 - "Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2* PREAMBLE + 2* ACK",
1.8 + "Overhead expressed in nanoseconds:DIFS+ SIFS + 2 * PREAMBLE + ACK",
1.9 UintegerValue (108000),
1.10 MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_overheadNanosec),
1.11 MakeUintegerChecker<uint32_t> (1)
1.12 @@ -80,9 +80,9 @@
1.13
1.14 WifiRemoteStation * station = mac->GetStationManager ()->Lookup (peerAddress);
1.15 NS_ASSERT (station != 0);
1.16 - Ptr<Packet> test_frame = Create<Packet> (m_testLength + m_headerLength + m_meshHeaderLength);
1.17 + Ptr<Packet> test_frame = Create<Packet> (m_testLength + m_meshHeaderLength);
1.18 uint32_t rate =
1.19 - station->GetDataMode (test_frame, m_testLength + m_headerLength + m_meshHeaderLength).GetDataRate ();
1.20 + station->GetDataMode (test_frame, m_testLength + m_meshHeaderLength).GetDataRate ();
1.21 uint32_t payload_nanosec = (uint32_t) (
1.22 (double) ((m_testLength + m_meshHeaderLength) * 8 /*octets -> bits*/) * sec2ns / ((double) rate));
1.23 uint32_t header_nanosec = (uint32_t) ((double) (m_headerLength * 8 /*octets -> bits*/* sec2ns)
2.1 --- a/src/devices/mesh/dot11s/airtime-metric.h Wed Oct 21 17:19:03 2009 -0700
2.2 +++ b/src/devices/mesh/dot11s/airtime-metric.h Fri Oct 23 15:34:14 2009 +0400
2.3 @@ -45,13 +45,13 @@
2.4 static TypeId GetTypeId ();
2.5 uint32_t CalculateMetric (Mac48Address peerAddress, Ptr<MeshWifiInterfaceMac> mac);
2.6 private:
2.7 - //\brief Overhead expressed in nanoseconds:DIFS+ 2* SIFS + 2*PREAMBLE + 2* ACK
2.8 + /// Overhead expressed in nanoseconds:DIFS + SIFS + 2 * PREAMBLE + ACK
2.9 uint32_t m_overheadNanosec;
2.10 - ///\brief Bt value
2.11 + /// Bt value
2.12 uint32_t m_testLength;
2.13 - ///\brief header length (used in overhead)
2.14 + /// header length (used in overhead)
2.15 uint16_t m_headerLength;
2.16 - ///\brief meshHeader length (6 octets usually)
2.17 + /// meshHeader length (minimum 6 octets)
2.18 uint16_t m_meshHeaderLength;
2.19 };
2.20 } //namespace dot11s
3.1 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc Wed Oct 21 17:19:03 2009 -0700
3.2 +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc Fri Oct 23 15:34:14 2009 +0400
3.3 @@ -33,6 +33,7 @@
3.4 #include "airtime-metric.h"
3.5 #include "ie-dot11s-preq.h"
3.6 #include "ie-dot11s-prep.h"
3.7 +#include "ns3/trace-source-accessor.h"
3.8 #include "ie-dot11s-perr.h"
3.9
3.10 NS_LOG_COMPONENT_DEFINE ("HwmpProtocol");
3.11 @@ -157,7 +158,13 @@
3.12 MakeBooleanAccessor (
3.13 &HwmpProtocol::m_rfFlag),
3.14 MakeBooleanChecker ()
3.15 - );
3.16 + )
3.17 + .AddTraceSource ( "RouteDiscoveryTime",
3.18 + "The time of route discovery procedure",
3.19 + MakeTraceSourceAccessor (
3.20 + &HwmpProtocol::m_routeDiscoveryTimeCallback)
3.21 + )
3.22 + ;
3.23 return tid;
3.24 }
3.25
3.26 @@ -201,14 +208,14 @@
3.27 HwmpProtocol::DoDispose ()
3.28 {
3.29 NS_LOG_FUNCTION_NOARGS ();
3.30 - for (std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.begin (); i != m_preqTimeouts.end (); i ++)
3.31 + for (std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.begin (); i != m_preqTimeouts.end (); i ++)
3.32 {
3.33 - i->second.Cancel ();
3.34 + i->second.preqTimeout.Cancel ();
3.35 }
3.36 m_proactivePreqTimer.Cancel();
3.37 m_preqTimeouts.clear ();
3.38 m_lastDataSeqno.clear ();
3.39 - m_lastHwmpSeqno.clear ();
3.40 + m_hwmpSeqnoMetricDatabase.clear ();
3.41 m_interfaces.clear ();
3.42 m_rqueue.clear ();
3.43 m_rtable = 0;
3.44 @@ -392,31 +399,24 @@
3.45 {
3.46 preq.IncrementMetric (metric);
3.47 //acceptance cretirea:
3.48 - std::map<Mac48Address, uint32_t>::const_iterator i = m_lastHwmpSeqno.find (preq.GetOriginatorAddress());
3.49 - if (i == m_lastHwmpSeqno.end ())
3.50 + std::map<Mac48Address, std::pair<uint32_t, uint32_t> >::const_iterator i = m_hwmpSeqnoMetricDatabase.find (
3.51 + preq.GetOriginatorAddress ());
3.52 + if (i != m_hwmpSeqnoMetricDatabase.end ())
3.53 {
3.54 - m_lastHwmpSeqno[preq.GetOriginatorAddress ()] = preq.GetOriginatorSeqNumber ();
3.55 - m_lastHwmpMetric[preq.GetOriginatorAddress ()] = preq.GetMetric ();
3.56 - }
3.57 - else
3.58 - {
3.59 - if ((int32_t)(i->second - preq.GetOriginatorSeqNumber ()) > 0)
3.60 + if ((int32_t)(i->second.first - preq.GetOriginatorSeqNumber ()) > 0)
3.61 {
3.62 return;
3.63 }
3.64 - if (i->second == preq.GetOriginatorSeqNumber ())
3.65 + if (i->second.first == preq.GetOriginatorSeqNumber ())
3.66 {
3.67 - //find metric
3.68 - std::map<Mac48Address, uint32_t>::const_iterator j = m_lastHwmpMetric.find (preq.GetOriginatorAddress());
3.69 - NS_ASSERT (j != m_lastHwmpSeqno.end ());
3.70 - if (j->second <= preq.GetMetric ())
3.71 + if (i->second.second <= preq.GetMetric ())
3.72 {
3.73 return;
3.74 }
3.75 }
3.76 - m_lastHwmpSeqno[preq.GetOriginatorAddress ()] = preq.GetOriginatorSeqNumber ();
3.77 - m_lastHwmpMetric[preq.GetOriginatorAddress ()] = preq.GetMetric ();
3.78 }
3.79 + m_hwmpSeqnoMetricDatabase[preq.GetOriginatorAddress ()] = std::make_pair (preq.GetOriginatorSeqNumber (), preq.GetMetric ());
3.80 +
3.81 NS_LOG_DEBUG("I am " << GetAddress () << "Accepted preq from address" << from << ", preq:" << preq);
3.82 std::vector<Ptr<DestinationAddressUnit> > destinations = preq.GetDestinationList ();
3.83 //Add reactive path to originator:
3.84 @@ -559,25 +559,16 @@
3.85 {
3.86 prep.IncrementMetric (metric);
3.87 //acceptance cretirea:
3.88 - std::map<Mac48Address, uint32_t>::const_iterator i = m_lastHwmpSeqno.find (prep.GetOriginatorAddress ());
3.89 - if (i == m_lastHwmpSeqno.end ())
3.90 + std::map<Mac48Address, std::pair<uint32_t, uint32_t> >::const_iterator i = m_hwmpSeqnoMetricDatabase.find (
3.91 + prep.GetOriginatorAddress ());
3.92 + if ((i != m_hwmpSeqnoMetricDatabase.end ()) && ((int32_t)(i->second.first - prep.GetOriginatorSeqNumber ()) > 0))
3.93 {
3.94 - m_lastHwmpSeqno[prep.GetOriginatorAddress ()] = prep.GetOriginatorSeqNumber ();
3.95 + return;
3.96 }
3.97 - else
3.98 - {
3.99 - if ((int32_t)(i->second - prep.GetOriginatorSeqNumber ()) > 0)
3.100 - {
3.101 - return;
3.102 - }
3.103 - else
3.104 - {
3.105 - m_lastHwmpSeqno[prep.GetOriginatorAddress ()] = prep.GetOriginatorSeqNumber ();
3.106 - }
3.107 - }
3.108 + m_hwmpSeqnoMetricDatabase[prep.GetOriginatorAddress ()] = std::make_pair (prep.GetOriginatorSeqNumber (), prep.GetMetric ());
3.109 //update routing info
3.110 //Now add a path to destination and add precursor to source
3.111 - NS_LOG_DEBUG("I am " << GetAddress () << ", received prep from " << prep.GetOriginatorAddress () << ", receiver was:" << from);
3.112 + NS_LOG_DEBUG ("I am " << GetAddress () << ", received prep from " << prep.GetOriginatorAddress () << ", receiver was:" << from);
3.113 HwmpRtable::LookupResult result = m_rtable->LookupReactive (prep.GetDestinationAddress ());
3.114 //Add a reactive path only if it is better than existing:
3.115 if (
3.116 @@ -904,6 +895,12 @@
3.117 void
3.118 HwmpProtocol::ReactivePathResolved (Mac48Address dst)
3.119 {
3.120 + std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.find (dst);
3.121 + if (i != m_preqTimeouts.end ())
3.122 + {
3.123 + m_routeDiscoveryTimeCallback (Simulator::Now () - i->second.whenScheduled);
3.124 + }
3.125 +
3.126 HwmpRtable::LookupResult result = m_rtable->LookupReactive (dst);
3.127 NS_ASSERT(result.retransmitter != Mac48Address::GetBroadcast ());
3.128 //Send all packets stored for this destination
3.129 @@ -950,12 +947,13 @@
3.130 bool
3.131 HwmpProtocol::ShouldSendPreq (Mac48Address dst)
3.132 {
3.133 - std::map<Mac48Address, EventId>::const_iterator i = m_preqTimeouts.find (dst);
3.134 + std::map<Mac48Address, PreqEvent>::const_iterator i = m_preqTimeouts.find (dst);
3.135 if (i == m_preqTimeouts.end ())
3.136 {
3.137 - m_preqTimeouts[dst] = Simulator::Schedule (
3.138 + m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
3.139 m_dot11MeshHWMPnetDiameterTraversalTime * Scalar (2),
3.140 &HwmpProtocol::RetryPathDiscovery, this, dst, 1);
3.141 + m_preqTimeouts[dst].whenScheduled = Simulator::Now ();
3.142 return true;
3.143 }
3.144 return false;
3.145 @@ -970,8 +968,8 @@
3.146 }
3.147 if (result.retransmitter != Mac48Address::GetBroadcast ())
3.148 {
3.149 - std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
3.150 - NS_ASSERT (i != m_preqTimeouts.end ());
3.151 + std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.find (dst);
3.152 + NS_ASSERT (i != m_preqTimeouts.end ());
3.153 m_preqTimeouts.erase (i);
3.154 return;
3.155 }
3.156 @@ -986,8 +984,9 @@
3.157 packet.reply (false, packet.pkt, packet.src, packet.dst, packet.protocol, HwmpRtable::MAX_METRIC);
3.158 packet = DequeueFirstPacketByDst (dst);
3.159 }
3.160 - std::map<Mac48Address, EventId>::iterator i = m_preqTimeouts.find (dst);
3.161 + std::map<Mac48Address, PreqEvent>::iterator i = m_preqTimeouts.find (dst);
3.162 NS_ASSERT (i != m_preqTimeouts.end ());
3.163 + m_routeDiscoveryTimeCallback (Simulator::Now () - i->second.whenScheduled);
3.164 m_preqTimeouts.erase (i);
3.165 return;
3.166 }
3.167 @@ -997,7 +996,7 @@
3.168 {
3.169 i->second->RequestDestination (dst, originator_seqno, dst_seqno);
3.170 }
3.171 - m_preqTimeouts[dst] = Simulator::Schedule (
3.172 + m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
3.173 Scalar (2 * (numOfRetry + 1)) * m_dot11MeshHWMPnetDiameterTraversalTime,
3.174 &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
3.175 }
3.176 @@ -1112,7 +1111,7 @@
3.177 "totalDropped=\"" << totalDropped << "\" "
3.178 "initiatedPreq=\"" << initiatedPreq << "\" "
3.179 "initiatedPrep=\"" << initiatedPrep << "\" "
3.180 - "initiatedPerr=\"" << initiatedPerr << "\"" << std::endl;
3.181 + "initiatedPerr=\"" << initiatedPerr << "\"/>" << std::endl;
3.182 }
3.183 void
3.184 HwmpProtocol::Report (std::ostream & os) const
4.1 --- a/src/devices/mesh/dot11s/hwmp-protocol.h Wed Oct 21 17:19:03 2009 -0700
4.2 +++ b/src/devices/mesh/dot11s/hwmp-protocol.h Fri Oct 23 15:34:14 2009 +0400
4.3 @@ -24,6 +24,7 @@
4.4 #include "ns3/mesh-l2-routing-protocol.h"
4.5 #include "ns3/nstime.h"
4.6 #include "ns3/event-id.h"
4.7 +#include "ns3/traced-value.h"
4.8 #include <vector>
4.9 #include <map>
4.10
4.11 @@ -156,6 +157,8 @@
4.12 */
4.13 bool DropDataFrame (uint32_t seqno, Mac48Address source);
4.14 //\}
4.15 + /// Route discovery time:
4.16 + TracedCallback<Time> m_routeDiscoveryTimeCallback;
4.17 ///\name Methods related to Queue/Dequeue procedures
4.18 ///\{
4.19 bool QueuePacket (QueuedPacket packet);
4.20 @@ -225,18 +228,20 @@
4.21 ///\{
4.22 /// Data sequence number database
4.23 std::map<Mac48Address, uint32_t> m_lastDataSeqno;
4.24 - /// DSN databse
4.25 - std::map<Mac48Address, uint32_t> m_lastHwmpSeqno;
4.26 - /// Metric database
4.27 - std::map<Mac48Address, uint32_t> m_lastHwmpMetric;
4.28 + /// keeps HWMP seqno (first in pair) and HWMP metric (second in pair) for each address
4.29 + std::map<Mac48Address, std::pair<uint32_t, uint32_t> > m_hwmpSeqnoMetricDatabase;
4.30 ///\}
4.31
4.32 /// Routing table
4.33 Ptr<HwmpRtable> m_rtable;
4.34
4.35 ///\name Timers:
4.36 - ///\{
4.37 - std::map<Mac48Address, EventId> m_preqTimeouts;
4.38 + //\{
4.39 + struct PreqEvent {
4.40 + EventId preqTimeout;
4.41 + Time whenScheduled;
4.42 + };
4.43 + std::map<Mac48Address, PreqEvent> m_preqTimeouts;
4.44 EventId m_proactivePreqTimer;
4.45 /// Random start in Proactive PREQ propagation
4.46 Time m_randomStart;
5.1 --- a/src/devices/mesh/dot11s/peer-link.cc Wed Oct 21 17:19:03 2009 -0700
5.2 +++ b/src/devices/mesh/dot11s/peer-link.cc Fri Oct 23 15:34:14 2009 +0400
5.3 @@ -94,6 +94,10 @@
5.4 m_peerMeshPointAddress (Mac48Address::GetBroadcast ()),
5.5 m_localLinkId (0),
5.6 m_peerLinkId (0),
5.7 + m_assocId (0),
5.8 + m_peerAssocId (0),
5.9 + m_lastBeacon (Seconds (0)),
5.10 + m_beaconInterval (Seconds (0)),
5.11 m_packetFail (0),
5.12 m_state (IDLE),
5.13 m_retryCounter (0),
5.14 @@ -188,6 +192,12 @@
5.15 {
5.16 return m_assocId;
5.17 }
5.18 +uint16_t
5.19 +PeerLink::GetPeerAid () const
5.20 +{
5.21 + return m_peerAssocId;
5.22 +}
5.23 +
5.24 Time
5.25 PeerLink::GetLastBeacon () const
5.26 {
6.1 --- a/src/devices/mesh/dot11s/peer-link.h Wed Oct 21 17:19:03 2009 -0700
6.2 +++ b/src/devices/mesh/dot11s/peer-link.h Fri Oct 23 15:34:14 2009 +0400
6.3 @@ -74,11 +74,9 @@
6.4 void SetPeerMeshPointAddress (Mac48Address macaddr);
6.5 void SetInterface (uint32_t interface);
6.6 void SetLocalLinkId (uint16_t id);
6.7 - //void SetPeerLinkId (uint16_t id);
6.8 void SetLocalAid (uint16_t aid);
6.9 - //void SetPeerAid (uint16_t aid);
6.10 + uint16_t GetPeerAid () const;
6.11 void SetBeaconTimingElement (IeBeaconTiming beaconTiming);
6.12 - //void SetPeerLinkDescriptorElement (IePeerManagement peerLinkElement);
6.13 Mac48Address GetPeerAddress () const;
6.14 uint16_t GetLocalAid () const;
6.15 Time GetLastBeacon () const;
7.1 --- a/src/devices/mesh/dot11s/peer-management-protocol-mac.cc Wed Oct 21 17:19:03 2009 -0700
7.2 +++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.cc Fri Oct 23 15:34:14 2009 +0400
7.3 @@ -69,22 +69,16 @@
7.4 {
7.5 MgtBeaconHeader beacon_hdr;
7.6 packet->RemoveHeader (beacon_hdr);
7.7 - //meshId.FindFirst (myBeacon);
7.8 - bool meshBeacon = false;
7.9 WifiInformationElementVector elements;
7.10 packet->RemoveHeader(elements);
7.11 Ptr<IeBeaconTiming> beaconTiming = DynamicCast<IeBeaconTiming> (elements.FindFirst (IE11S_BEACON_TIMING));
7.12 Ptr<IeMeshId> meshId = DynamicCast<IeMeshId> (elements.FindFirst (IE11S_MESH_ID));
7.13
7.14 - if ((beaconTiming != 0) && (meshId != 0))
7.15 + if ((meshId != 0) && (m_protocol->GetMeshId ()->IsEqual (*meshId)))
7.16 {
7.17 - if (m_protocol->GetMeshId ()->IsEqual (*meshId))
7.18 - {
7.19 - meshBeacon = true;
7.20 - }
7.21 + m_protocol->ReceiveBeacon (m_ifIndex, header.GetAddr2 (), MicroSeconds (
7.22 + beacon_hdr.GetBeaconIntervalUs ()), beaconTiming);
7.23 }
7.24 - m_protocol->UpdatePeerBeaconTiming (m_ifIndex, meshBeacon, *beaconTiming, header.GetAddr2 (),
7.25 - Simulator::Now (), MicroSeconds (beacon_hdr.GetBeaconIntervalUs ()));
7.26 // Beacon shall not be dropeed. May be needed to another plugins
7.27 return true;
7.28 }
7.29 @@ -190,9 +184,13 @@
7.30 void
7.31 PeerManagementProtocolMac::UpdateBeacon (MeshWifiBeacon & beacon) const
7.32 {
7.33 - Ptr<IeBeaconTiming> beaconTiming = m_protocol->GetBeaconTimingElement (m_ifIndex);
7.34 - beacon.AddInformationElement (beaconTiming);
7.35 + if (m_protocol->GetBeaconCollisionAvoidance ())
7.36 + {
7.37 + Ptr<IeBeaconTiming> beaconTiming = m_protocol->GetBeaconTimingElement (m_ifIndex);
7.38 + beacon.AddInformationElement (beaconTiming);
7.39 + }
7.40 beacon.AddInformationElement (m_protocol->GetMeshId ());
7.41 + m_protocol->NotifyBeaconSent (m_ifIndex, beacon.GetBeaconInterval ());
7.42 }
7.43
7.44 void
7.45 @@ -269,14 +267,6 @@
7.46 return Mac48Address::Mac48Address ();
7.47 }
7.48 }
7.49 -std::pair<Time, Time>
7.50 -PeerManagementProtocolMac::GetBeaconInfo () const
7.51 -{
7.52 - std::pair<Time, Time> retval;
7.53 - retval.first = m_parent->GetTbtt ();
7.54 - retval.second = m_parent->GetBeaconInterval ();
7.55 - return retval;
7.56 -}
7.57 void
7.58 PeerManagementProtocolMac::SetBeaconShift (Time shift)
7.59 {
8.1 --- a/src/devices/mesh/dot11s/peer-management-protocol-mac.h Wed Oct 21 17:19:03 2009 -0700
8.2 +++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.h Fri Oct 23 15:34:14 2009 +0400
8.3 @@ -86,15 +86,8 @@
8.4 ///// Closes link when a proper number of successive transmissions have failed
8.5 void TxError (WifiMacHeader const &hdr);
8.6 void TxOk (WifiMacHeader const &hdr);
8.7 - ///\name BCA functionallity:
8.8 - ///\{
8.9 - ///\brief Fills TBTT and beacon interval. Needed by BCA
8.10 - ///functionallity
8.11 - ///\param first in retval is TBTT
8.12 - ///\param second in retval is beacon interval
8.13 - std::pair<Time, Time> GetBeaconInfo () const;
8.14 + ///BCA functionallity:
8.15 void SetBeaconShift (Time shift);
8.16 - ///\}
8.17 void SetPeerManagerProtcol (Ptr<PeerManagementProtocol> protocol);
8.18 void SendPeerLinkManagementFrame (
8.19 Mac48Address peerAddress,
9.1 --- a/src/devices/mesh/dot11s/peer-management-protocol.cc Wed Oct 21 17:19:03 2009 -0700
9.2 +++ b/src/devices/mesh/dot11s/peer-management-protocol.cc Fri Oct 23 15:34:14 2009 +0400
9.3 @@ -55,18 +55,25 @@
9.4 &PeerManagementProtocol::m_maxNumberOfPeerLinks),
9.5 MakeUintegerChecker<uint8_t> ()
9.6 )
9.7 - .AddAttribute ( "MaxBeaconLossForBeaconTiming",
9.8 - "If maximum number of beacons were lost, station will not included in beacon timing element",
9.9 - UintegerValue (3),
9.10 + .AddAttribute ( "MaxBeaconShiftValue",
9.11 + "Maximum number of TUs for beacon shifting",
9.12 + UintegerValue (15),
9.13 MakeUintegerAccessor (
9.14 - &PeerManagementProtocol::m_maxBeaconLostForBeaconTiming),
9.15 - MakeUintegerChecker<uint8_t> ()
9.16 + &PeerManagementProtocol::m_maxBeaconShift),
9.17 + MakeUintegerChecker<uint16_t> ()
9.18 )
9.19 + .AddAttribute ( "EnableBeaconCollisionAvoidance",
9.20 + "Enable/Disable Beacon collision avoidance.",
9.21 + BooleanValue (true),
9.22 + MakeBooleanAccessor (
9.23 + &PeerManagementProtocol::SetBeaconCollisionAvoidance, &PeerManagementProtocol::GetBeaconCollisionAvoidance),
9.24 + MakeBooleanChecker ()
9.25 + )
9.26 ;
9.27 return tid;
9.28 }
9.29 PeerManagementProtocol::PeerManagementProtocol () :
9.30 - m_lastAssocId (0), m_lastLocalLinkId (1), m_maxBeaconLostForBeaconTiming (3)
9.31 + m_lastAssocId (0), m_lastLocalLinkId (1), m_enableBca (true), m_maxBeaconShift (15)
9.32 {
9.33 }
9.34 PeerManagementProtocol::~PeerManagementProtocol ()
9.35 @@ -87,13 +94,6 @@
9.36 j->second.clear ();
9.37 }
9.38 m_peerLinks.clear ();
9.39 - //cleaning beacon structures:
9.40 - for (BeaconInfoMap::iterator i = m_neighbourBeacons.begin (); i != m_neighbourBeacons.end (); i++)
9.41 - {
9.42 - i->second.clear ();
9.43 - }
9.44 - m_neighbourBeacons.clear ();
9.45 -
9.46 m_plugins.clear ();
9.47 }
9.48
9.49 @@ -128,89 +128,33 @@
9.50 Ptr<IeBeaconTiming>
9.51 PeerManagementProtocol::GetBeaconTimingElement (uint32_t interface)
9.52 {
9.53 + if (!GetBeaconCollisionAvoidance ())
9.54 + {
9.55 + return 0;
9.56 + }
9.57 Ptr<IeBeaconTiming> retval = Create<IeBeaconTiming> ();
9.58 - BeaconInfoMap::iterator i = m_neighbourBeacons.find (interface);
9.59 - if (i == m_neighbourBeacons.end ())
9.60 + PeerLinksMap::iterator iface = m_peerLinks.find (interface);
9.61 + NS_ASSERT (iface != m_peerLinks.end ());
9.62 + for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
9.63 {
9.64 - return retval;
9.65 - }
9.66 - bool cleaned = false;
9.67 - while (!cleaned)
9.68 - {
9.69 - BeaconsOnInterface::iterator start = i->second.begin ();
9.70 - for (BeaconsOnInterface::iterator j = start; j != i->second.end (); j++)
9.71 + //If we do not know peer Assoc Id, we shall not add any info
9.72 + //to a beacon timing element
9.73 + if ((*i)->GetBeaconInterval () == Seconds (0))
9.74 {
9.75 - //check beacon loss and make a timing element
9.76 - //if last beacon was m_maxBeaconLostForBeaconTiming beacons ago - we do not put it to the
9.77 - //timing element
9.78 - if ((j->second.referenceTbtt + j->second.beaconInterval * Scalar (m_maxBeaconLostForBeaconTiming))
9.79 - < Simulator::Now ())
9.80 - {
9.81 - start = j;
9.82 - i->second.erase (j);
9.83 - break;
9.84 - }
9.85 + //No beacon was received, do not include to the beacon timing element
9.86 + continue;
9.87 }
9.88 - cleaned = true;
9.89 - }
9.90 - for (BeaconsOnInterface::const_iterator j = i->second.begin (); j != i->second.end (); j++)
9.91 - {
9.92 - retval->AddNeighboursTimingElementUnit (j->second.aid, j->second.referenceTbtt,
9.93 - j->second.beaconInterval);
9.94 + retval->AddNeighboursTimingElementUnit ((*i)->GetLocalAid (), (*i)->GetLastBeacon (),
9.95 + (*i)->GetBeaconInterval ());
9.96 }
9.97 return retval;
9.98 }
9.99 -
9.100 void
9.101 -PeerManagementProtocol::FillBeaconInfo (uint32_t interface, Mac48Address peerAddress, Time receivingTime,
9.102 - Time beaconInterval)
9.103 +PeerManagementProtocol::ReceiveBeacon (uint32_t interface, Mac48Address peerAddress, Time beaconInterval, Ptr<IeBeaconTiming> timingElement)
9.104 {
9.105 - BeaconInfoMap::iterator i = m_neighbourBeacons.find (interface);
9.106 - if (i == m_neighbourBeacons.end ())
9.107 - {
9.108 - BeaconsOnInterface newMap;
9.109 - m_neighbourBeacons[interface] = newMap;
9.110 - }
9.111 - i = m_neighbourBeacons.find (interface);
9.112 - BeaconsOnInterface::iterator j = i->second.find (peerAddress);
9.113 - if (j == i->second.end ())
9.114 - {
9.115 - BeaconInfo newInfo;
9.116 - newInfo.referenceTbtt = receivingTime;
9.117 - newInfo.beaconInterval = beaconInterval;
9.118 - newInfo.aid = m_lastAssocId++;
9.119 - if (m_lastAssocId == 0xff)
9.120 - {
9.121 - m_lastAssocId = 0;
9.122 - }
9.123 - i->second[peerAddress] = newInfo;
9.124 - }
9.125 - else
9.126 - {
9.127 - j->second.referenceTbtt = receivingTime;
9.128 - j->second.beaconInterval = beaconInterval;
9.129 - }
9.130 -}
9.131 -
9.132 -void
9.133 -PeerManagementProtocol::UpdatePeerBeaconTiming (uint32_t interface, bool meshBeacon,
9.134 - IeBeaconTiming timingElement, Mac48Address peerAddress, Time receivingTime, Time beaconInterval)
9.135 -{
9.136 - FillBeaconInfo (interface, peerAddress, receivingTime, beaconInterval);
9.137 - if (!meshBeacon)
9.138 - {
9.139 - return;
9.140 - }
9.141 - //BCA:
9.142 - PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
9.143 - NS_ASSERT (plugin != m_plugins.end ());
9.144 - Time shift = GetNextBeaconShift (interface);
9.145 - if (TimeToTu (shift) != 0)
9.146 - {
9.147 - plugin->second->SetBeaconShift (shift);
9.148 - }
9.149 //PM STATE Machine
9.150 //Check that a given beacon is not from our interface
9.151 + Simulator::Schedule (beaconInterval - TuToTime (m_maxBeaconShift + 1), &PeerManagementProtocol::DoShiftBeacon, this, interface);
9.152 for (PeerManagementProtocolMacMap::const_iterator i = m_plugins.begin (); i != m_plugins.end (); i++)
9.153 {
9.154 if (i->second->GetAddress () == peerAddress)
9.155 @@ -219,21 +163,19 @@
9.156 }
9.157 }
9.158 Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
9.159 - if (peerLink != 0)
9.160 - {
9.161 - peerLink->SetBeaconTimingElement (timingElement);
9.162 - peerLink->SetBeaconInformation (receivingTime, beaconInterval);
9.163 - }
9.164 - else
9.165 + if (peerLink == 0)
9.166 {
9.167 if (ShouldSendOpen (interface, peerAddress))
9.168 {
9.169 - peerLink = InitiateLink (interface, peerAddress, Mac48Address::GetBroadcast (), receivingTime,
9.170 - beaconInterval);
9.171 - peerLink->SetBeaconTimingElement (timingElement);
9.172 + peerLink = InitiateLink (interface, peerAddress, Mac48Address::GetBroadcast ());
9.173 peerLink->MLMEActivePeerLinkOpen ();
9.174 }
9.175 }
9.176 + peerLink->SetBeaconInformation (Simulator::Now (), beaconInterval);
9.177 + if (GetBeaconCollisionAvoidance ())
9.178 + {
9.179 + peerLink->SetBeaconTimingElement (*PeekPointer (timingElement));
9.180 + }
9.181 }
9.182
9.183 void
9.184 @@ -248,8 +190,7 @@
9.185 bool reject = !(ShouldAcceptOpen (interface, peerAddress, reasonCode));
9.186 if (peerLink == 0)
9.187 {
9.188 - peerLink = InitiateLink (interface, peerAddress, peerMeshPointAddress, Simulator::Now (), Seconds (
9.189 - 1.0));
9.190 + peerLink = InitiateLink (interface, peerAddress, peerMeshPointAddress);
9.191 }
9.192 if (!reject)
9.193 {
9.194 @@ -307,26 +248,9 @@
9.195 }
9.196 Ptr<PeerLink>
9.197 PeerManagementProtocol::InitiateLink (uint32_t interface, Mac48Address peerAddress,
9.198 - Mac48Address peerMeshPointAddress, Time lastBeacon, Time beaconInterval)
9.199 + Mac48Address peerMeshPointAddress)
9.200 {
9.201 Ptr<PeerLink> new_link = CreateObject<PeerLink> ();
9.202 - if (m_lastLocalLinkId == 0xff)
9.203 - {
9.204 - m_lastLocalLinkId = 0;
9.205 - }
9.206 - //find a beacon entry
9.207 - BeaconInfoMap::iterator beaconsOnInterface = m_neighbourBeacons.find (interface);
9.208 - if (beaconsOnInterface == m_neighbourBeacons.end ())
9.209 - {
9.210 - FillBeaconInfo (interface, peerAddress, lastBeacon, beaconInterval);
9.211 - }
9.212 - beaconsOnInterface = m_neighbourBeacons.find (interface);
9.213 - BeaconsOnInterface::iterator beacon = beaconsOnInterface->second.find (peerAddress);
9.214 - if (beacon == beaconsOnInterface->second.end ())
9.215 - {
9.216 - FillBeaconInfo (interface, peerAddress, lastBeacon, beaconInterval);
9.217 - }
9.218 - beacon = beaconsOnInterface->second.find (peerAddress);
9.219 //find a peer link - it must not exist
9.220 if (FindPeerLink (interface, peerAddress) != 0)
9.221 {
9.222 @@ -337,17 +261,17 @@
9.223 NS_ASSERT (plugin != m_plugins.end ());
9.224 PeerLinksMap::iterator iface = m_peerLinks.find (interface);
9.225 NS_ASSERT (iface != m_peerLinks.end ());
9.226 - new_link->SetLocalAid (beacon->second.aid);
9.227 + new_link->SetLocalAid (m_lastAssocId++);
9.228 new_link->SetInterface (interface);
9.229 new_link->SetLocalLinkId (m_lastLocalLinkId++);
9.230 new_link->SetPeerAddress (peerAddress);
9.231 new_link->SetPeerMeshPointAddress (peerMeshPointAddress);
9.232 - new_link->SetBeaconInformation (lastBeacon, beaconInterval);
9.233 new_link->SetMacPlugin (plugin->second);
9.234 new_link->MLMESetSignalStatusCallback (MakeCallback (&PeerManagementProtocol::PeerLinkStatus, this));
9.235 iface->second.push_back (new_link);
9.236 return new_link;
9.237 }
9.238 +
9.239 Ptr<PeerLink>
9.240 PeerManagementProtocol::FindPeerLink (uint32_t interface, Mac48Address peerAddress)
9.241 {
9.242 @@ -377,13 +301,14 @@
9.243 {
9.244 m_peerStatusCallback = cb;
9.245 }
9.246 +
9.247 std::vector<Mac48Address>
9.248 -PeerManagementProtocol::GetActiveLinks (uint32_t interface)
9.249 +PeerManagementProtocol::GetPeers (uint32_t interface) const
9.250 {
9.251 std::vector<Mac48Address> retval;
9.252 - PeerLinksMap::iterator iface = m_peerLinks.find (interface);
9.253 + PeerLinksMap::const_iterator iface = m_peerLinks.find (interface);
9.254 NS_ASSERT (iface != m_peerLinks.end ());
9.255 - for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
9.256 + for (PeerLinksOnInterface::const_iterator i = iface->second.begin (); i != iface->second.end (); i++)
9.257 {
9.258 if ((*i)->LinkIsEstab ())
9.259 {
9.260 @@ -392,6 +317,21 @@
9.261 }
9.262 return retval;
9.263 }
9.264 +
9.265 +std::vector< Ptr<PeerLink> >
9.266 +PeerManagementProtocol::GetPeerLinks () const
9.267 +{
9.268 + std::vector< Ptr<PeerLink> > links;
9.269 +
9.270 + for (PeerLinksMap::const_iterator iface = m_peerLinks.begin (); iface != m_peerLinks.end (); ++iface)
9.271 + {
9.272 + for (PeerLinksOnInterface::const_iterator i = iface->second.begin ();
9.273 + i != iface->second.end (); i++)
9.274 + if ((*i)->LinkIsEstab ())
9.275 + links.push_back (*i);
9.276 + }
9.277 + return links;
9.278 +}
9.279 bool
9.280 PeerManagementProtocol::IsActiveLink (uint32_t interface, Mac48Address peerAddress)
9.281 {
9.282 @@ -407,6 +347,7 @@
9.283 {
9.284 return (m_stats.linksTotal <= m_maxNumberOfPeerLinks);
9.285 }
9.286 +
9.287 bool
9.288 PeerManagementProtocol::ShouldAcceptOpen (uint32_t interface, Mac48Address peerAddress,
9.289 PmpReasonCode & reasonCode)
9.290 @@ -418,56 +359,70 @@
9.291 }
9.292 return true;
9.293 }
9.294 -Time
9.295 -PeerManagementProtocol::GetNextBeaconShift (uint32_t interface)
9.296 +
9.297 +void
9.298 +PeerManagementProtocol::DoShiftBeacon (uint32_t interface)
9.299 {
9.300 - //REMINDER:: in timing element 1) last beacon reception time is measured in units of 256 microseconds
9.301 - // 2) beacon interval is mesured in units of 1024 microseconds
9.302 - // 3) hereafter TU = 1024 microseconds
9.303 - //So, the shift is a random integer variable uniformly distributed in [-15;-1] U [1;15]
9.304 - static int maxShift = 15;
9.305 - static int minShift = 1;
9.306 - UniformVariable randomSign (-1, 1);
9.307 - UniformVariable randomShift (minShift, maxShift);
9.308 + if (!GetBeaconCollisionAvoidance ())
9.309 + {
9.310 + return;
9.311 + }
9.312 + // If beacon interval is equal to the neighbor's one and one o more beacons received
9.313 + // by my neighbor coincide with my beacon - apply random uniformly distributed shift from
9.314 + // [-m_maxBeaconShift, m_maxBeaconShift] except 0.
9.315 + UniformVariable beaconShift (-m_maxBeaconShift, m_maxBeaconShift);
9.316 PeerLinksMap::iterator iface = m_peerLinks.find (interface);
9.317 NS_ASSERT (iface != m_peerLinks.end ());
9.318 - PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
9.319 + PeerManagementProtocolMacMap::const_iterator plugin = m_plugins.find (interface);
9.320 NS_ASSERT (plugin != m_plugins.end ());
9.321 - std::pair<Time, Time> myBeacon = plugin->second->GetBeaconInfo ();
9.322 - if (Simulator::Now () + TuToTime (maxShift) > myBeacon.first + myBeacon.second)
9.323 + std::map<uint32_t, Time>::const_iterator lastBeacon = m_lastBeacon.find (interface);
9.324 + std::map<uint32_t, Time>::const_iterator beaconInterval = m_beaconInterval.find (interface);
9.325 + if ((lastBeacon == m_lastBeacon.end ()) || (beaconInterval == m_beaconInterval.end ()))
9.326 {
9.327 - return MicroSeconds (0);
9.328 + return;
9.329 + }
9.330 + if (TuToTime (m_maxBeaconShift) > m_beaconInterval[interface])
9.331 + {
9.332 + NS_FATAL_ERROR ("Wrong beacon shift parameters");
9.333 + return;
9.334 }
9.335 for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end (); i++)
9.336 {
9.337 IeBeaconTiming::NeighboursTimingUnitsList neighbours;
9.338 - if ((*i)->LinkIsIdle ())
9.339 - {
9.340 - continue;
9.341 - }
9.342 neighbours = (*i)->GetBeaconTimingElement ().GetNeighboursTimingElementsList ();
9.343 //Going through all my timing elements and detecting future beacon collisions
9.344 for (IeBeaconTiming::NeighboursTimingUnitsList::const_iterator j = neighbours.begin (); j
9.345 != neighbours.end (); j++)
9.346 {
9.347 - //We apply MBAC only if beacon Intervals are equal
9.348 - if ((*j)->GetBeaconInterval () == TimeToTu (myBeacon.second))
9.349 + if ((*i)->GetPeerAid () == (*j)->GetAid ())
9.350 {
9.351 - //Apply MBCA if future beacons may coinside
9.352 - if ((TimeToTu (myBeacon.first) - ((*j)->GetLastBeacon () / 4)) % ((*j)->GetBeaconInterval ())
9.353 - == 0)
9.354 + // I am present at neighbour's list of neighbors
9.355 + continue;
9.356 + }
9.357 + //Beacon interval is stored in TU's
9.358 + if (((*j)->GetBeaconInterval ()) != TimeToTu(beaconInterval->second))
9.359 + {
9.360 + continue;
9.361 + }
9.362 + //Timing element keeps beacon receiving times in 256us units, TU=1024us
9.363 + if ((int) ((int)(*j)->GetLastBeacon () / 4 - (int)TimeToTu (lastBeacon->second)) % TimeToTu (
9.364 + beaconInterval->second)
9.365 + != 0)
9.366 + {
9.367 + continue;
9.368 + }
9.369 + int shift = 0;
9.370 + do
9.371 {
9.372 - int beaconShift = randomShift.GetInteger (minShift, maxShift) * ((randomSign.GetValue ()
9.373 - >= 0) ? 1 : -1);
9.374 - NS_LOG_DEBUG ("Apply MBCA: Shift value = " << beaconShift << " beacon TUs");
9.375 - //Do not shift to the past!
9.376 - return (TuToTime (beaconShift) + Simulator::Now () < myBeacon.first) ? TuToTime (
9.377 - beaconShift) : TuToTime (0);
9.378 + shift = (int) beaconShift.GetValue ();
9.379 }
9.380 - }
9.381 + while (shift == 0);
9.382 + PeerManagementProtocolMacMap::iterator plugin = m_plugins.find (interface);
9.383 + NS_ASSERT (plugin != m_plugins.end ());
9.384 + plugin->second->SetBeaconShift (TuToTime (shift));
9.385 + return;
9.386 }
9.387 }
9.388 - return MicroSeconds (0);
9.389 }
9.390 Time
9.391 PeerManagementProtocol::TuToTime (uint32_t x)
9.392 @@ -533,6 +488,12 @@
9.393 {
9.394 return m_address;
9.395 }
9.396 +void
9.397 +PeerManagementProtocol::NotifyBeaconSent (uint32_t interface, Time beaconInterval)
9.398 +{
9.399 + m_lastBeacon[interface] = Simulator::Now ();
9.400 + m_beaconInterval[interface] = beaconInterval;
9.401 +}
9.402 PeerManagementProtocol::Statistics::Statistics (uint16_t t) :
9.403 linksTotal (t), linksOpened (0), linksClosed (0)
9.404 {
9.405 @@ -574,6 +535,16 @@
9.406 }
9.407 }
9.408
9.409 +void
9.410 +PeerManagementProtocol::SetBeaconCollisionAvoidance (bool enable)
9.411 +{
9.412 + m_enableBca = enable;
9.413 +}
9.414 +bool
9.415 +PeerManagementProtocol::GetBeaconCollisionAvoidance () const
9.416 +{
9.417 + return m_enableBca;
9.418 +}
9.419 } // namespace dot11s
9.420 } //namespace ns3
9.421
10.1 --- a/src/devices/mesh/dot11s/peer-management-protocol.h Wed Oct 21 17:19:03 2009 -0700
10.2 +++ b/src/devices/mesh/dot11s/peer-management-protocol.h Fri Oct 23 15:34:14 2009 +0400
10.3 @@ -74,25 +74,12 @@
10.4 */
10.5 Ptr<IeBeaconTiming> GetBeaconTimingElement (uint32_t interface);
10.6 /**
10.7 - * \brief When we receive a beacon from peer-station, we remember
10.8 - * its beacon timing element (needed for peer choosing mechanism),
10.9 - * and remember beacon timers - last beacon and beacon interval to
10.10 - * detect beacon loss and cancel links
10.11 - * \param interface is a interface on which beacon was received
10.12 - * \param meshBeacon indicates whether the beacon is mesh beacon or not.
10.13 - * \param timingElement is a timing element of remote beacon
10.14 - * \param peerAddress is an address where a beacon was received from
10.15 - * \param receivingTime is a time when beacon was received
10.16 - * \param beaconInterval is a beacon interval of received beacon
10.17 + * \brief To initiate peer link we must notify about received beacon
10.18 + * \param interface the interface where a beacon was received from
10.19 + * \param peerAddress address of station, which sent a beacon
10.20 + * \param beaconInterval beacon interval (needed by beacon loss counter)
10.21 */
10.22 - void UpdatePeerBeaconTiming (
10.23 - uint32_t interface,
10.24 - bool meshBeacon,
10.25 - IeBeaconTiming timingElement,
10.26 - Mac48Address peerAddress,
10.27 - Time receivingTime,
10.28 - Time beaconInterval
10.29 - );
10.30 + void ReceiveBeacon (uint32_t interface, Mac48Address peerAddress, Time beaconInterval, Ptr<IeBeaconTiming> beaconTiming);
10.31 //\}
10.32 /**
10.33 * \brief Methods that handle Peer link management frames
10.34 @@ -137,16 +124,26 @@
10.35 */
10.36 bool IsActiveLink (uint32_t interface, Mac48Address peerAddress);
10.37 //\}
10.38 - ///\brief Needed by external module to do MLME
10.39 + ///\name Interface to other protocols (MLME)
10.40 + //\{
10.41 + /// Set peer link status change callback
10.42 + void SetPeerLinkStatusCallback (Callback<void, Mac48Address, Mac48Address, uint32_t, bool> cb);
10.43 + /// Find active peer link by my interface and peer interface MAC
10.44 Ptr<PeerLink> FindPeerLink (uint32_t interface, Mac48Address peerAddress);
10.45 - void SetPeerLinkStatusCallback (Callback<void, Mac48Address, Mac48Address, uint32_t, bool> cb);
10.46 - std::vector<Mac48Address> GetActiveLinks (uint32_t interface);
10.47 - ///\brief needed by plugins to set global source address
10.48 + /// Get list of all active peer links
10.49 + std::vector < Ptr<PeerLink> > GetPeerLinks () const;
10.50 + /// Get list of active peers of my given interface
10.51 + std::vector<Mac48Address> GetPeers (uint32_t interface) const;
10.52 + /// Get mesh point address. TODO this used by plugins only. Now MAC plugins can ask MP addrress directly from main MAC
10.53 Mac48Address GetAddress ();
10.54 - ///\brief Needed to fill mesh configuration
10.55 uint8_t GetNumberOfLinks ();
10.56 void SetMeshId (std::string s);
10.57 Ptr<IeMeshId> GetMeshId () const;
10.58 + /// Enable or disable beacon collision avoidance
10.59 + void SetBeaconCollisionAvoidance (bool enable);
10.60 + bool GetBeaconCollisionAvoidance () const;
10.61 + /// Notify about beacon send event, needed to schedule BCA
10.62 + void NotifyBeaconSent (uint32_t interface, Time beaconInterval);
10.63 ///\brief: Report statistics
10.64 void Report (std::ostream &) const;
10.65 void ResetStats ();
10.66 @@ -177,16 +174,10 @@
10.67 PeerManagementProtocol& operator= (const PeerManagementProtocol &);
10.68 PeerManagementProtocol (const PeerManagementProtocol &);
10.69
10.70 - /**
10.71 - * \brief Fills information of received beacon. Needed to form own beacon timing element
10.72 - */
10.73 - void FillBeaconInfo (uint32_t interface, Mac48Address peerAddress, Time receivingTime, Time beaconInterval);
10.74 Ptr<PeerLink> InitiateLink (
10.75 uint32_t interface,
10.76 Mac48Address peerAddress,
10.77 - Mac48Address peerMeshPointAddress,
10.78 - Time lastBeacon,
10.79 - Time beaconInterval
10.80 + Mac48Address peerMeshPointAddress
10.81 );
10.82 /**
10.83 * \name External peer-chooser
10.84 @@ -200,7 +191,7 @@
10.85 */
10.86 void PeerLinkStatus (uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddres, PeerLink::PeerState ostate, PeerLink::PeerState nstate);
10.87 ///\brief BCA
10.88 - Time GetNextBeaconShift (uint32_t interface);
10.89 + void DoShiftBeacon (uint32_t interface);
10.90 /**
10.91 * \name Time<-->TU converters:
10.92 * \{
10.93 @@ -212,16 +203,19 @@
10.94 PeerManagementProtocolMacMap m_plugins;
10.95 Mac48Address m_address;
10.96 Ptr<IeMeshId> m_meshId;
10.97 - /**
10.98 - * \name Information related to beacons:
10.99 - * \{
10.100 - */
10.101 - BeaconInfoMap m_neighbourBeacons;
10.102 - ///\}
10.103 +
10.104 uint16_t m_lastAssocId;
10.105 uint16_t m_lastLocalLinkId;
10.106 uint8_t m_maxNumberOfPeerLinks;
10.107 - uint8_t m_maxBeaconLostForBeaconTiming;
10.108 + /// Flag which enables BCA
10.109 + bool m_enableBca;
10.110 + /// Beacon can be shifted at [-m_maxBeaconShift; +m_maxBeaconShift] TUs
10.111 + uint16_t m_maxBeaconShift;
10.112 + ///Last beacon at each interface
10.113 + std::map<uint32_t, Time> m_lastBeacon;
10.114 + ///Beacon interval at each interface
10.115 + std::map<uint32_t, Time> m_beaconInterval;
10.116 +
10.117 /**
10.118 * \name Peer Links
10.119 * \{
11.1 --- a/src/devices/mesh/mesh-wifi-beacon.cc Wed Oct 21 17:19:03 2009 -0700
11.2 +++ b/src/devices/mesh/mesh-wifi-beacon.cc Fri Oct 23 15:34:14 2009 +0400
11.3 @@ -35,6 +35,11 @@
11.4 m_elements.AddInformationElement (ie);
11.5 }
11.6
11.7 +Time
11.8 +MeshWifiBeacon::GetBeaconInterval () const
11.9 +{
11.10 + return MicroSeconds (m_header.GetBeaconIntervalUs ());
11.11 +}
11.12
11.13 Ptr<Packet>
11.14 MeshWifiBeacon::CreatePacket ()
12.1 --- a/src/devices/mesh/mesh-wifi-beacon.h Wed Oct 21 17:19:03 2009 -0700
12.2 +++ b/src/devices/mesh/mesh-wifi-beacon.h Fri Oct 23 15:34:14 2009 +0400
12.3 @@ -58,6 +58,8 @@
12.4 * \param mpAddress is mesh point address
12.5 */
12.6 WifiMacHeader CreateHeader (Mac48Address address, Mac48Address mpAddress);
12.7 + ///Returns a beacon interval of wifi beacon
12.8 + Time GetBeaconInterval () const;
12.9 /// Create frame = { beacon header + all information elements sorted by ElementId () }
12.10 Ptr<Packet> CreatePacket ();
12.11
13.1 --- a/src/helper/dot11s-installer.cc Wed Oct 21 17:19:03 2009 -0700
13.2 +++ b/src/helper/dot11s-installer.cc Fri Oct 23 15:34:14 2009 +0400
13.3 @@ -75,7 +75,7 @@
13.4 //Install interaction between HWMP and Peer management protocol:
13.5 //PeekPointer()'s to avoid circular Ptr references
13.6 pmp->SetPeerLinkStatusCallback (MakeCallback (&HwmpProtocol::PeerLinkStatus, PeekPointer (hwmp)));
13.7 - hwmp->SetNeighboursCallback (MakeCallback (&PeerManagementProtocol::GetActiveLinks, PeekPointer (pmp)));
13.8 + hwmp->SetNeighboursCallback (MakeCallback (&PeerManagementProtocol::GetPeers, PeekPointer (pmp)));
13.9 return true;
13.10 }
13.11 void