<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"> Hi all,<br> I've met a trouble during my simulation.I write my own forwarding strategy and run it in the 11-node 2-bottlenect topology.But,the simulation is collapsed during the first data packet returning.I used gdb to debug it and no exception caught.Here is the log when I run the scenario:<br>Waf: Leaving directory `/home/lok/ndnSIM/scenario/build'<br>'build' finished successfully (27.229s)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7418, NodeId:, 0, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7968, NodeId:, 1, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7c18, NodeId:, 2, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7eb8, NodeId:, 3, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108, NodeId:, 4, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_Intere
stRate:AddFace(0x9af8108, NodeId:, 4, ;FaceId:, 1)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108, NodeId:, 4, ;FaceId:, 2)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108, NodeId:, 4, ;FaceId:, 3)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108, NodeId:, 4, ;FaceId:, 4)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8108, NodeId:, 4, ;FaceId:, 5)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af88e0, NodeId:, 5, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af88e0, NodeId:, 5, ;FaceId:, 1)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70, NodeId:, 6, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70, NodeId:, 6, ;FaceId:, 1)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70, NodeId:, 6, ;FaceId:, 2)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70, NodeId:, 6, ;FaceId:, 3)<br>0s -1 ndn.fw.MyFw
Strategy_InterestRate:AddFace(0x9af8d70, NodeId:, 6, ;FaceId:, 4)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af8d70, NodeId:, 6, ;FaceId:, 5)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9578, NodeId:, 7, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af98e8, NodeId:, 8, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9c58, NodeId:, 9, ;FaceId:, 0)<br>0s -1 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9afa028, NodeId:, 10, ;FaceId:, 0)<br>0s 0 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af7418, NodeId:, 0, ;FaceId:, 1)<br>0s 7 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9578, NodeId:, 7, ;FaceId:, 1)<br>0s 8 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af98e8, NodeId:, 8, ;FaceId:, 1)<br>0s 9 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9af9c58, NodeId:, 9, ;FaceId:, 1)<br>0s 10 ndn.fw.MyFwStrategy_InterestRate:AddFace(0x9afa028, NodeId:, 10, ;FaceId:, 1)<br>0s 0
ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af7418)<br>0s 0 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(0)(1,y,1)<br>0s 0 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af7418, /data/p1/%00, NodeId:, 0, ;FaceId:, 0)<br>0s 0 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af7418Interest Sended Count 1<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af8108)<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(4)(1,y,1)<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af8108, /data/p1/%00, NodeId:, 4, ;FaceId:, 4)<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af8108Interest Sended Count 1<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(5)(2,y,1)<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af8108, /data/p1/%
00, NodeId:, 4, ;FaceId:, 5)<br>0.0500264s 4 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af8108Interest Sended Count 1<br>0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af88e0)<br>0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(1)(1,y,1)<br>0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af88e0, /data/p1/%00, NodeId:, 5, ;FaceId:, 1)<br>0.0512904s 5 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af88e0Interest Sended Count 1<br>0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af8d70)<br>0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=net(2)(1,y,1)<br>0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af8d70, /data/p1/%00, NodeId:, 6, ;FaceId:, 2)<br>0.0525544s 6 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af8d70Interest Sended Count 1<br>0.053
5808s 7 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(0x9af9578)<br>0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DoPropagateInterest(): [DEBUG] Trying dev=local(1)(0,g,0)<br>0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(0x9af9578, /data/p1/%00, /data/p1/%00, NodeId:, 7, ;FaceId:, 1)<br>0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(): [DEBUG] 0x9af9578SatisfyInterest Count 1<br>0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(0x9af9578, /data/p1/%00, NodeId:, 7, ;FaceId:, 1)<br>0.0535808s 7 ndn.fw.MyFwStrategy_InterestRate:DidSendOutInterest(): [DEBUG] 0x9af9578Interest Sended Count 1<br>0.0554312s 6 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(0x9af8d70, /data/p1/%00, /data/p1/%00, NodeId:, 6, ;FaceId:, 2)<br>0.0554312s 6 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(): [DEBUG] 0x9af8d70SatisfyInterest Count 1<br>0.0649352s 5 ndn.fw.MyFwStrategy_InterestRate:W
illSatisfyPendingInterest(0x9af88e0, /data/p1/%00, /data/p1/%00, NodeId:, 5, ;FaceId:, 1)<br>0.0649352s 5 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(): [DEBUG] 0x9af88e0SatisfyInterest Count 1<br>0.0702904s 6 ndn.fw.MyFwStrategy_InterestRate:WillSatisfyPendingInterest(root@ubuntu:/home/lok/ndnSIM/scenario# <br> <br> The log shows that the simulation collapsed after the router(node 5) receiving the data packet.<br> <br> The follow is my forwarding strategy:<br>#include "MyFwStrategy_InterestRate.h"<br>#include "interestsatisfiedrate.h"<br><br>#include "ns3/ndn-fib.h"<br>#include "ns3/ndn-fib-entry.h"<br>#include "ns3/ndn-pit-entry.h"<br>#include "ns3/ndn-interest.h"<br>#include "ns3/ndn-face.h"<br>#include "ns3/node.h"<br><br>#include "ns3/assert.h"<br>#include "ns3/log.h"<br>#include "ns3/simulator.h"<br>#include "ns3/boolean.h"<br><br>#include <boost/ref.hpp>
<br>#include <boost/foreach.hpp><br>#include <boost/lambda/lambda.hpp><br>#include <boost/lambda/bind.hpp><br><br>#include "iostream"<br><br>namespace ll = boost::lambda;<br>namespace ns3{<br>namespace ndn{<br>namespace fw{<br> NS_OBJECT_ENSURE_REGISTERED(MyFwStrategy_InterestRate);<br><br> LogComponent MyFwStrategy_InterestRate::g_log = LogComponent (MyFwStrategy_InterestRate::GetLogName ().c_str ());<br><br> std::string MyFwStrategy_InterestRate::GetLogName ()<br> {<br> return "ndn.fw.MyFwStrategy_InterestRate";<br> }<br><br> TypeId MyFwStrategy_InterestRate::GetTypeId (void)<br> {<br> static TypeId tid = TypeId ("ns3::ndn::fw::MyFwStrategy_InterestRate")<br> .SetGroupName ("Ndn")<br> &n
bsp; .SetParent <ForwardingStrategy> ()<br> .AddConstructor <MyFwStrategy_InterestRate> ()<br><br> // .AddAttribute ("Attribute", "Attribute spec",<br> // StringValue ("DefaultValue"),<br> // MakeStringAccessor (&<br> // MakeStringChecker ())<br> ;<br>  
; return tid;<br> }<br><br> MyFwStrategy_InterestRate::MyFwStrategy_InterestRate(){}<br><br> void MyFwStrategy_InterestRate::AddFace (Ptr<Face> face){<br> NS_LOG_FUNCTION(this << " NodeId:" << face->GetNode()->GetId() <<";FaceId:"<< face->GetId());<br> ObjectFactory factory;<br> const std::string typeId = "ns3::ndn::InterestSatisfiedRate";<br> factory.SetTypeId(typeId);<br> Ptr<Object> interestSatisfiedRate =factory.Create();<br> //Ptr<InterestSatisfiedRate> interestSatisfiedRate = <br> // CreateObject<InterestSatisfiedRate>(); <br> &nb
sp; //NS_LOG_DEBUG("after AddFace");<br> face->AggregateObject(interestSatisfiedRate);<br> super::AddFace(face);<br> }<br><br> void MyFwStrategy_InterestRate::DidSendOutInterest (Ptr<Face> inFace, Ptr<Face> outFace,Ptr<const Interest> interest,Ptr<pit::Entry> pitEntry){<br> NS_LOG_FUNCTION(this << pitEntry->GetPrefix()<< " NodeId:" << outFace->GetNode()->GetId() <<";FaceId:"<< outFace->GetId());<br> super::DidSendOutInterest (inFace,outFace,interest,pitEntry);<br> Ptr<InterestSatisfiedRate> interestSatisfiedRate = <br> outFace->GetObject<InterestSatisfiedRate>();<br> &n
bsp; interestSatisfiedRate-> addOutInterests();<br> NS_LOG_DEBUG(this << "Interest Sended Count " << interestSatisfiedRate-> getOutInterests());<br> }<br><br> void MyFwStrategy_InterestRate::WillSatisfyPendingInterest (Ptr<Face> inFace,Ptr<pit::Entry> pitEntry){<br> NS_LOG_FUNCTION(this << pitEntry->GetPrefix()<< pitEntry->GetPrefix()<< " NodeId:" << inFace->GetNode()->GetId() <<";FaceId:"<< inFace->GetId()); <br> super::WillSatisfyPendingInterest (inFace,pitEntry);<br> Ptr<InterestSatisfiedRate> interestSatisfiedRate = <br> inFace->GetObject<InterestSatisfiedRate>();<br> &nb
sp; interestSatisfiedRate-> addSatisfiedInterests();<br> NS_LOG_DEBUG(this << "SatisfyInterest Count " << interestSatisfiedRate-> getSatisfiedInterests());<br><br> }<br><br> //void MyFwStrategy_InterestRate::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry){<br> // NS_LOG_FUNCTION(this << pitEntry->GetPrefix());<br> // super::WillEraseTimedOutPendingInterest (pitEntry);<br> // BOOST_FOREACH(const fib::FaceMetric &metricFace,pitEntry->GetFibEntry())<br> //}<br><br> bool MyFwStrategy_InterestRate::DoPropagateInterest (Ptr<Face> inFace,Ptr<const Interest> interest,Ptr<pit::Entry> pitEntry){<br> NS_LOG_FUNCTION (this);<br>
int propagatedCount = 0;<br> BOOST_FOREACH (const fib::FaceMetric &metricFace, pitEntry->GetFibEntry ()->m_faces.get<fib::i_metric> ())<br> {<br> NS_LOG_DEBUG ("Trying " << boost::cref(metricFace));<br> if (metricFace.GetStatus () == fib::FaceMetric::NDN_FIB_RED) // all non-read faces are in the front of the list<br> break;<br> if (!TrySendOutInterest (inFace, metricFace.GetFace (), interest, pitEntry))<br> {<br> continue;<br> }<br> &nb
sp; propagatedCount++;<br> }<br> //NS_LOG_INFO ("Propagated to " << propagatedCount << " faces");<br> return propagatedCount > 0;<br> }<br> <br> <br> <br>}<br>}<br>}<br><br> By the way,the scenario is correct because I run another forwarding strategy in it successfully.<br><br><br></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>