diff --git a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc index 8945fb17b..c0d68580b 100644 --- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc +++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc @@ -142,17 +142,6 @@ HwmpMacPlugin::UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, header.SetAddr1(tag.GetAddress()); return true; } -#if 0 -HwmpMacPlugin::HwmpMacPlugin (): -{ -} - -HwmpMacPlugin::~HwmpMacPlugin () -{ - m_preqQueue.clear (); -} -//Interaction with HWMP: -#endif void HwmpMacPlugin::SendPreq(IePreq preq) { @@ -205,73 +194,14 @@ HwmpMacPlugin::RequestDestination (Mac48Address dst) m_preqQueue.push_back (preq); //set iterator position to my preq: m_myPreq = m_preqQueue.end () -1; - NS_LOG_UNCOND("no preq"); SendOnePreq (); } else { NS_ASSERT (m_myPreq->GetOriginatorAddress() == m_parent->GetAddress()); - NS_LOG_UNCOND ("add a destination "<AddDestinationAddressElement (false, false, dst, 0); //DO = 0, RF = 0 } } -#if 0 -void -HwmpMacPlugin::SendPathError (std::vector destinations) -{ - std::vector receivers = m_retransmittersOfPerrCallback (destinations, m_ifIndex); - NS_LOG_DEBUG ("SendPathError started"); - if (receivers.size () == 0) - return; - NS_LOG_DEBUG (m_address<<" Should Send PERR to"); - for (unsigned int i = 0; i < receivers.size (); i ++) - { - AddPerrReceiver (receivers[i]); - NS_LOG_DEBUG (receivers[i]); - } - NS_LOG_DEBUG ("To tel about failure with"); - for (unsigned int i = 0; i < destinations.size (); i ++) - { - m_myPerr.AddAddressUnit (destinations[i]); - NS_LOG_DEBUG (destinations[i].destination); - } - if (!m_perrTimer.IsRunning ()) - { - m_perrCallback (m_myPerr,m_myPerrReceivers); - m_myPerr.ResetPerr (); - m_perrTimer = Simulator::Schedule (dot11sParameters::dot11MeshHWMPperrMinInterval,&HwmpMacPlugin::SendOnePerr,this); - } -} -void -HwmpMacPlugin::ReceivePerr (IeDot11sPerr& perr, const Mac48Address& from) -{ - if (m_disabled) - return; - NS_LOG_DEBUG (m_address<<" RECEIVED PERR from "< destinations = perr.GetAddressUnitVector (); - for (unsigned int i = 0; i < destinations.size (); i ++) - { - /** - * Lookup for a valid routing information - */ - HwmpRtable::LookupResult result = m_requestRouteCallback (destinations[i].destination); - if ( - (result.retransmitter != from) - || (result.seqnum >= destinations[i].seqnum) - ) - - perr.DeleteAddressUnit (destinations[i].destination); - } - NS_LOG_DEBUG ("Retransmit "<<(int)perr.GetNumOfDest()); - if (perr.GetNumOfDest () == 0) - return; - destinations = perr.GetAddressUnitVector (); - SendPathError (destinations); -} -#endif void HwmpMacPlugin::SendOnePreq () { @@ -281,7 +211,6 @@ HwmpMacPlugin::SendOnePreq () return; if (m_myPreq == m_preqQueue.begin ()) m_myPreq == m_preqQueue.end (); - NS_LOG_UNCOND ("I am "<GetAddress ()<<"sending PREQ:"<GetAddress ()); hdr.SetAddr3 (prep.GetDestinationAddress ()); //Send Management frame - NS_LOG_UNCOND("Sending PREP"); m_parent->SendManagementFrame(packet, hdr); } void diff --git a/src/devices/mesh/dot11s/hwmp-mac-plugin.h b/src/devices/mesh/dot11s/hwmp-mac-plugin.h index d4516b7bb..1398f64c1 100644 --- a/src/devices/mesh/dot11s/hwmp-mac-plugin.h +++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.h @@ -89,48 +89,6 @@ private: }; MyPerr m_myPerr; }; - -#if 0 -class HwmpMacPlugin : public MeshWifiInterfaceMacPlugin { -public: - private: - //true means that we can add a destination to - //existing PREQ element - //False means that we must send - void SendPrep ( - Mac48Address dst, //dst is PREQ's originator address - Mac48Address src, //src is PREQ's destination address - Mac48Address retransmitter, - uint32_t initMetric, - uint32_t dsn,/* taken form PREQ*/ - uint32_t originatorDsn, //taken from rtable or as m_myDsn ++; - uint32_t lifetime //taken from PREQ - ); - //HWMP interaction callbacks: - Callback m_routingInfoCallback; - Callback, std::vector, uint32_t> m_retransmittersOfPerrCallback; - Callback m_requestRouteCallback; - Callback m_requestRootPathCallback; - //Mac interaction callbacks: - Callback m_preqCallback; - Callback m_prepCallback; - Callback > m_perrCallback; - //HwmpCounters: - uint32_t m_preqId; - uint32_t m_myDsn; - //Seqno and metric database - std::map m_dsnDatabase; - std::map m_preqMetricDatabase; - //Disable/enable functionality - bool m_disabled; - //Proactive PREQ mechanism: - EventId m_proactivePreqTimer; - void SendProactivePreq (); - IeDot11sPerr m_myPerr; - EventId m_perrTimer; - void SendOnePerr (); -}; -#endif } //namespace dot11s } //namespace ns3 #endif diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index 4280f456f..7a231afd5 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -172,7 +172,6 @@ HwmpProtocol::RequestRoute ( tag.SetTtl (m_maxTtl+1); if (m_dataSeqno == 0xffffffff) m_dataSeqno = 0; - NS_LOG_UNCOND("add a tag"<GetUid()); packet->AddPacketTag(tag); } } @@ -320,7 +319,6 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface) } if ((*i)->GetDestinationAddress () == m_address) { - NS_LOG_UNCOND("PREQ has reached destination:"<GetDestinationAddress()); SendPrep ( m_address, @@ -373,7 +371,7 @@ HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface) if (preq.GetDestCount () == 0) return; //Forward PREQ to all interfaces: - NS_LOG_UNCOND("I am "<second->SendPreq (preq); } @@ -382,7 +380,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface) { prep.IncrementMetric (1); //acceptance cretirea: - NS_LOG_UNCOND("I am "<::iterator i = m_lastHwmpSeqno.find (prep.GetOriginatorAddress()); if (i == m_lastHwmpSeqno.end ()) { @@ -408,10 +406,7 @@ HwmpProtocol::ReceivePrep (IePrep prep, Mac48Address from, uint32_t interface) //try to look for default route result = m_rtable->LookupProactive (); if (result.retransmitter == Mac48Address::GetBroadcast ()) - { - NS_LOG_UNCOND("I am "<AddPrecursor (prep.GetOriginatorAddress (), interface, result.retransmitter); //Forward PREP HwmpPluginMap::iterator prep_sender = m_interfaces.find (result.ifIndex); @@ -423,13 +418,13 @@ void HwmpProtocol::ReceivePerr (IePerr perr, Mac48Address from, uint32_t interface) { //Acceptance cretirea: - NS_LOG_UNCOND("I am "< destinations = perr.GetAddressUnitVector (); HwmpRtable::LookupResult result; for(unsigned int i = 0; i < destinations.size (); i ++) { result = m_rtable->LookupReactive (destinations[i].destination); - NS_LOG_UNCOND("Destination = "< mp) mp->SetRoutingProtocol (this); // Mesh point aggregates all installed protocols mp->AggregateObject (this); - //Address tmp_addr = mp->GetAddress (); - //Mac48Address * address = dynamic_cast (&tmp_addr); - //if (address == NULL) - // return false; m_address = Mac48Address::ConvertFrom (mp->GetAddress ());//* address; return true; } @@ -505,9 +496,7 @@ void HwmpProtocol::PeerLinkStatus(Mac48Address peerAddress, uint32_t interface, bool status) { if(status) - { - // m_rtable->AddReactivePath(peerAddress, peerAddress, interface, 1, Seconds (0), 0); - } + m_rtable->AddReactivePath(peerAddress, peerAddress, interface, 1, Seconds (0), 0); else { std::vector destinations = m_rtable->GetUnreachableDestinations (peerAddress); @@ -533,101 +522,13 @@ HwmpProtocol::DropDataFrame(uint32_t seqno, Mac48Address source) } return false; } - -#if 0 -void -HwmpProtocol::ObtainRoutingInformation ( - HwmpProtocolState::INFO info -) -{ - switch (info.type) - { - case HwmpProtocolState::INFO_PREP: - if (info.me != info.source) - { - m_rtable->AddPrecursor (info.source, info.outPort, info.nextHop); - m_rtable->AddPrecursor (info.destination, info.outPort, info.prevHop); - NS_LOG_DEBUG ("path to "<AddReactivePath ( - info.destination, - info.nextHop, - info.outPort, - info.metric, - info.lifetime, - info.dsn); - SendAllPossiblePackets (info.destination); - break; - case HwmpProtocolState::INFO_PERR: - //delete first subentry - case HwmpProtocolState::INFO_PROACTIVE: - //add information to the root MP. - m_rtable->AddProactivePath ( - info.metric, - info.destination, - info.nextHop, - info.outPort, - info.lifetime, - info.dsn); - //Set mode as PROACTIVE: - SetProactive (info.outPort); - break; - case HwmpProtocolState::INFO_NEW_PEER: -#if 0 - m_rtable->AddReactivePath ( - info.destination, - info.nextHop, - info.outPort, - info.metric, - Seconds (0), - 0); -#endif - break; - case HwmpProtocolState::INFO_FAILED_PEER: - /** - * Conditions for generating PERR - */ - { - NS_LOG_DEBUG ("Failed peer"< failedDestinations = - m_rtable->GetUnreachableDestinations (info.destination, info.outPort); - /** - * Entry about peer does not contain seqnum - */ - HwmpRtable::FailedDestination peer; - peer.destination = info.destination; - peer.seqnum = 0; - failedDestinations.push_back (peer); - MakePathError (failedDestinations, info.outPort); - } - break; - default: - return; - } -} -#endif void HwmpProtocol::MakePathError (std::vector destinations) { - NS_LOG_UNCOND ("START PERR, I am "<::iterator i = destinations.begin (); i != destinations.end (); i ++) - { - HwmpRtable::LookupResult result = m_rtable->LookupReactiveExpired (i->destination); - NS_LOG_UNCOND("Address::"<destination<<", next hop is "< > receivers = GetPerrReceivers (destinations); - NS_LOG_UNCOND("Number of perr receivers:"< >::iterator i = receivers.begin (); i != receivers.end (); i ++) - NS_LOG_UNCOND("Address:"<second<<", interface:"<first); - //form a path error and send it to proper ports IePerr perr; for(unsigned int i = 0; i < destinations.size (); i ++) { @@ -642,7 +543,6 @@ HwmpProtocol::MakePathError (std::vector destinations receivers_for_interface.push_back(receivers[j].second); i->second->SendOnePerr (perr, receivers_for_interface); } - } std::vector > HwmpProtocol::GetPerrReceivers (std::vector failedDest) @@ -657,16 +557,10 @@ HwmpProtocol::GetPerrReceivers (std::vector failedDes retval.push_back(precursors[j]); } //Check if we have dublicates in retval and precursors: - unsigned int size = retval.size(); - for (unsigned int i = 0; i < size; i ++) - for (unsigned int j = i; j < size; j ++) + for (unsigned int i = 0; i < retval.size(); i ++) + for (unsigned int j = i; j < retval.size(); j ++) if(retval[i].second == retval[j].second) - { - //erase and check size - NS_LOG_UNCOND("deleting dublicate"); retval.erase(retval.begin() + j); - size --; - } return retval; } std::vector @@ -762,7 +656,6 @@ HwmpProtocol::ShouldSendPreq (Mac48Address dst) std::map::iterator i = m_preqTimeouts.find (dst); if (i == m_preqTimeouts.end ()) { - NS_LOG_UNCOND("Timeout is:" <<2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())); m_preqTimeouts[dst] = Simulator::Schedule ( MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())), &HwmpProtocol::RetryPathDiscovery, this, dst, 0); @@ -801,11 +694,7 @@ HwmpProtocol::RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry) return; } for(HwmpPluginMap::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++) - { i->second->RequestDestination(dst); - i->second->RequestDestination(Mac48Address("00:00:00:00:00:10")); - i->second->RequestDestination(Mac48Address("00:00:00:00:00:24")); - } m_preqTimeouts[dst] = Simulator::Schedule ( MilliSeconds (2*(m_dot11MeshHWMPnetDiameterTraversalTime.GetMilliSeconds())), &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);