From 042aee075658ca50b2fcc9c9f37ba36e16b64355 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Mon, 3 Aug 2009 19:13:46 +0400 Subject: [PATCH] Added path update to FLAME --- examples/mesh.cc | 1 + src/devices/mesh/dot11s/hwmp-protocol.cc | 3 +-- src/devices/mesh/flame/flame-protocol.cc | 33 ++++++++++++++---------- src/devices/wifi/mac-low.cc | 1 + 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/examples/mesh.cc b/examples/mesh.cc index ebb7c2fd7..230349cbc 100644 --- a/examples/mesh.cc +++ b/examples/mesh.cc @@ -179,6 +179,7 @@ MeshTest::Run () Simulator::Schedule (Seconds(totalTime), & MeshTest::Report, this); Simulator::Stop (Seconds (totalTime)); Simulator::Run (); + std::cerr << "finish success\n"; Simulator::Destroy (); return 0; } diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index b756e543d..c56e9c801 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -201,13 +201,12 @@ HwmpProtocol::DoDispose () { i->second.Cancel (); } + m_proactivePreqTimer.Cancel(); m_preqTimeouts.clear (); m_lastDataSeqno.clear (); m_lastHwmpSeqno.clear (); m_rqueue.clear (); m_rtable = 0; - - //TODO: clear plugins } bool diff --git a/src/devices/mesh/flame/flame-protocol.cc b/src/devices/mesh/flame/flame-protocol.cc index b8272e3d0..4d51a2afa 100644 --- a/src/devices/mesh/flame/flame-protocol.cc +++ b/src/devices/mesh/flame/flame-protocol.cc @@ -186,9 +186,14 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co FlameHeader flameHdr; packet->RemoveHeader (flameHdr); FlameTag tag; + if (!packet->RemovePacketTag (tag)) { - NS_FATAL_ERROR ("FLAME tag must exust here"); + NS_FATAL_ERROR ("FLAME tag must exist here"); + } + if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface)) + { + return false; } if (source == GetAddress ()) { @@ -215,10 +220,7 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co } else { - if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface)) - { - return false; - } + FlameRtable::LookupResult result = m_rtable->Lookup (destination); if (tag.receiver != Mac48Address::GetBroadcast ()) { @@ -265,12 +267,22 @@ FlameProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source { NS_FATAL_ERROR ("FLAME tag must exist when packet is coming to protocol"); } - //TODO: send path update FlameHeader flameHdr; packet->RemoveHeader (flameHdr); + if ((destination == GetAddress ()) && (m_lastBroadcast + m_broadcastInterval < Simulator::Now ())) + { + Ptr packet = Create (); + m_mp->Send(packet, Mac48Address::GetBroadcast (), 0); + m_lastBroadcast = Simulator::Now (); + } NS_ASSERT (protocolType == FLAME_PROTOCOL); protocolType = flameHdr.GetProtocol (); - return (!HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface)); + if ((HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface)) + || packet->GetSize () == 0) + { + return false; + } + return true; } bool FlameProtocol::Install (Ptr mp) @@ -316,12 +328,7 @@ FlameProtocol::HandleDataFrame (uint16_t seqno, Mac48Address source, const Flame return true; } FlameRtable::LookupResult result = m_rtable->Lookup (source); - if (result.retransmitter == Mac48Address::GetBroadcast ()) - { - m_rtable->AddPath (source, receiver, fromInterface, flameHdr.GetCost (), flameHdr.GetSeqno ()); - return false; - } - if (result.seqnum >= seqno) + if ((result.retransmitter != Mac48Address::GetBroadcast ()) && (result.seqnum >= seqno)) { return true; } diff --git a/src/devices/wifi/mac-low.cc b/src/devices/wifi/mac-low.cc index bc0ee2035..ae7d80e73 100644 --- a/src/devices/wifi/mac-low.cc +++ b/src/devices/wifi/mac-low.cc @@ -331,6 +331,7 @@ MacLow::CancelAllEvents (void) m_listener->Cancel (); m_listener = 0; } + NS_LOG_UNCOND("DONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } void