From 4a5151fd9010567c8b03b96f913932fd98b77c41 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Thu, 30 Apr 2009 20:43:52 +0400 Subject: [PATCH] Some fixes --- src/devices/mesh/dot11s/hwmp-protocol.cc | 11 +++++------ src/devices/mesh/dot11s/hwmp-rtable.cc | 22 ++++++++++------------ src/devices/mesh/dot11s/wscript | 3 +++ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index 74a374e17..d76d4186d 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -435,9 +435,8 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface, M //!NB: If there is information from peer - set lifetime as //we have got from PREQ, and set the rest lifetime of the //route if the information is correct - uint32_t lifetime = preq.GetLifetime (); - if(result.lifetime != Seconds (0.0)) - lifetime = result.lifetime.GetMicroSeconds () / 1024; + uint32_t lifetime = result.lifetime.GetMicroSeconds () / 1024; + NS_ASSERT(lifetime > 0); SendPrep ( (*i)->GetDestinationAddress (), preq.GetOriginatorAddress (), @@ -488,7 +487,6 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M NS_LOG_DEBUG("I am "<LookupReactive(prep.GetDestinationAddress()); //Add a reactive path only if it is better than existing: - m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from); if ( ((m_rtable->LookupReactive(prep.GetOriginatorAddress ())).retransmitter == Mac48Address::GetBroadcast ()) || ((m_rtable->LookupReactive(prep.GetOriginatorAddress ())).metric > prep.GetMetric ()) @@ -501,6 +499,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M prep.GetMetric (), MicroSeconds(prep.GetLifetime () * 1024), prep.GetOriginatorSeqNumber ()); + m_rtable->AddPrecursor (prep.GetDestinationAddress (), interface, from); if(result.retransmitter != Mac48Address::GetBroadcast ()) m_rtable->AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter); ReactivePathResolved (prep.GetOriginatorAddress ()); @@ -532,7 +531,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface, M //Forward PREP HwmpPluginMap::const_iterator prep_sender = m_interfaces.find (result.ifIndex); NS_ASSERT(prep_sender != m_interfaces.end ()); - prep_sender->second->SendPrep(prep, result.retransmitter); + prep_sender->second->SendPrep (prep, result.retransmitter); } void HwmpProtocol::ReceivePerr (IePerr perr, Mac48Address from, uint32_t interface, Mac48Address fromMp) @@ -580,7 +579,7 @@ HwmpProtocol::SendPrep ( prep.SetOriginatorSeqNumber (originatorDsn); HwmpPluginMap::const_iterator prep_sender = m_interfaces.find (interface); NS_ASSERT(prep_sender != m_interfaces.end ()); - prep_sender->second->SendPrep(prep, retransmitter); + prep_sender->second->SendPrep (prep, retransmitter); //m_prepCallback (prep, retransmitter); } diff --git a/src/devices/mesh/dot11s/hwmp-rtable.cc b/src/devices/mesh/dot11s/hwmp-rtable.cc index 3dbba3dfb..9535a3a74 100644 --- a/src/devices/mesh/dot11s/hwmp-rtable.cc +++ b/src/devices/mesh/dot11s/hwmp-rtable.cc @@ -80,11 +80,7 @@ HwmpRtable::AddReactivePath ( i->second.retransmitter = retransmitter; i->second.interface = interface; i->second.metric = metric; - if (lifetime != Seconds (0)) - i->second.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds()); - else - // Information about peer does not have lifetime - i->second.whenExpire = Seconds (0); + i->second.whenExpire = Simulator::Now() + lifetime; i->second.seqnum = seqnum; } @@ -101,7 +97,7 @@ HwmpRtable::AddProactivePath ( m_root.root = root; m_root.retransmitter = retransmitter; m_root.metric = metric; - m_root.whenExpire = MilliSeconds (Simulator::Now().GetMilliSeconds() + lifetime.GetMilliSeconds()); + m_root.whenExpire = Simulator::Now() + lifetime; m_root.seqnum = seqnum; m_root.interface = interface; } @@ -171,10 +167,7 @@ HwmpRtable::LookupReactive (Mac48Address destination) NS_LOG_DEBUG ("Reactive route has expired, sorry."); return LookupResult(); } - Time lifetime = Seconds (0.0); - if (i->second.whenExpire != Seconds (0)) - lifetime = i->second.whenExpire - Simulator::Now (); - return LookupResult (i->second.retransmitter, i->second.interface, i->second.metric, i->second.seqnum); + return LookupReactiveExpired (destination); } HwmpRtable::LookupResult @@ -183,7 +176,12 @@ HwmpRtable::LookupReactiveExpired (Mac48Address destination) std::map::iterator i = m_routes.find (destination); if (i == m_routes.end ()) return LookupResult (); - return LookupResult (i->second.retransmitter, i->second.interface, i->second.metric, i->second.seqnum); + return LookupResult ( + i->second.retransmitter, + i->second.interface, + i->second.metric, i->second.seqnum, + i->second.whenExpire - Simulator::Now () + ); } HwmpRtable::LookupResult @@ -200,7 +198,7 @@ HwmpRtable::LookupProactive () HwmpRtable::LookupResult HwmpRtable::LookupProactiveExpired () { - return LookupResult(m_root.retransmitter, m_root.interface, m_root.metric, m_root.seqnum); + return LookupResult(m_root.retransmitter, m_root.interface, m_root.metric, m_root.seqnum, m_root.whenExpire - Simulator::Now ()); } std::vector diff --git a/src/devices/mesh/dot11s/wscript b/src/devices/mesh/dot11s/wscript index 7f530b155..ccf298f53 100644 --- a/src/devices/mesh/dot11s/wscript +++ b/src/devices/mesh/dot11s/wscript @@ -27,6 +27,9 @@ def build(bld): headers.module = 'dot11s' headers.source = [ 'peer-management-protocol.h', + 'ie-dot11s-beacon-timing.h', + 'ie-dot11s-peer-management.h', + 'ie-dot11s-perr.h', 'hwmp-protocol.h', 'dot11s-helper.h', 'dot11s-mac-header.h',