<div dir="ltr">Dear Okuma,<div>A few days ago, I encountered a similar error while trying to get a copy of the interest packet in Forwarder.cpp (<font face="arial, sans-serif"><span style="color:rgb(0,0,0);white-space:pre-wrap"><b><i>onOutgoingInterest</i></b></span> method)</font>: <br></div><span class="gmail-im" style="color:rgb(80,0,80)"><font color="#ff0000"> terminate called after throwing an instance of 'std::bad_weak_ptr'<br></font><div><font color="#ff0000"> what(): bad_weak_ptr</font></div></span><div><font face="arial, sans-serif">So after </font>several attempts, <font face="arial, sans-serif">i changed the instantiation of Interest object like that:</font></div><div><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><font face="arial, sans-serif"><b><i>shared_ptr<Interest> <span style="color:rgb(34,34,34);white-space:normal">interestForPIT </span>= make_shared<Interest>(interest);</i></b></font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><font face="arial, sans-serif">According to your code, Before invoking: <b><i>m_pit.insert </i></b>method; y should instantiate another Interest object, like that:</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><font face="arial, sans-serif">  <b><i>shared_ptr<Interest> interest2 = interestForPIT;</i></b><br></font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><font face="arial, sans-serif"> <b><i> m_pit.insert(*interest2).first;</i></b></font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><font face="arial, sans-serif">Maybe this is not the optimal or the best method, but that solved my problem.</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><font face="arial, sans-serif">Hope that would help.</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><font face="arial, sans-serif"><br></font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><font face="arial, sans-serif">Regards</font></pre></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 14 déc. 2019 à 22:41, DJEMAA Adel <<a href="mailto:a_djemaa@esi.dz">a_djemaa@esi.dz</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Dear Okuma,<div>A few days ago, I encountered a similar error while trying to get a copy of the interest packet in Forwarder.cpp (<font face="arial, sans-serif"><span style="color:rgb(0,0,0);white-space:pre-wrap"><b><i>onOutgoingInterest</i></b></span> method)</font>: <br></div><font color="#ff0000"> terminate called after throwing an instance of 'std::bad_weak_ptr'<br></font><div><font color="#ff0000"> what(): bad_weak_ptr</font></div><div><font face="arial, sans-serif">So after </font>several attempts, <font face="arial, sans-serif">i changed the instantiation of Interest object like that:</font></div><div><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0)"><font face="arial, sans-serif"><b><i>shared_ptr<Interest> <span style="color:rgb(34,34,34);white-space:normal">interestForPIT </span>= make_shared<Interest>(interest);</i></b></font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0)"><font face="arial, sans-serif">According to your code, Before invoking: <b><i>m_pit.insert </i></b>method; y should instantiate another Interest object, like that:</font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0)"><font face="arial, sans-serif">  <b><i>shared_ptr<Interest> interest2 = interestForPIT;</i></b><br></font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0)"><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif"> <b><i> m_pit.insert(*interest2).first;</i></b></font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif">Maybe this is not the optimal or the best method, but that solved my problem.</font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif">Hope that would help.</font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif"><br></font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif">Regards</font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif"><b><i><br></i></b></font></pre><pre style="margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><font face="arial, sans-serif"><b><i><br></i></b></font></pre><pre style="font-size:14px;font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap"><br></pre><font face="Courier New, Courier, monospace, arial, sans-serif" style="font-size:14px">

</font></pre></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 14 déc. 2019 à 09:36, Hiroya Okuma <<a href="mailto:okuma@stu.kobe-u.ac.jp" target="_blank">okuma@stu.kobe-u.ac.jp</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Lixia Zhang<br>
<br>
As you said, the router does not know the relationship between "/prefix/A" and "/prefix/A+B".  Therefore, I want to add a process to make the router divide Interest Name and create PIT entries for the number of requested files.  (For ease of division, it is assumed that each file names are the same size.)<br>
<br>
It is only necessary to temporarily create an Interest for creating PIT entries for multiple request file names.  <br>
<br>
Currently, the onIncomingInterest method of the Forwarder class of ndnSIM is being modified.<br>
I think there are two ways.<br>
<br>
1.Multiple request file names obtained by dividing are stored in an array, and processing for setting each file name in Interest and creating a PIT entry is repeated.<br>
→ According to your advice, routers cannot set interest names<br>
<br>
2.Prepare an instance of Interest class to create PIT entry in onIncomingInterest method (?)<br>
Example: <br>
void<br>
Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)<br>
{<br>
...// Divide file name and store in array "nameVec"<br>
 for (unsigned int i=0; i<nameVec.size(); i++){<br>
   Interest interestForPIT = interest;<br>
   interestForPIT.setName(nameVec[i]);<br>
   shared_ptr<pit::Entry> pitEntry = m_pit.insert(interestForPIT).first;<br>
   ...<br>
 }<br>
}<br>
→ error <br>
terminate called after throwing an instance of 'std::bad_weak_ptr'<br>
 what(): bad_weak_ptr<br>
<br>
I don't have much experience with ndnSIM, so it may be a rudimentary question.<br>
<br>
Please let me know if there are any good methods other than the above two methods.<br>
<br>
Best Wishes,<br>
<br>
Hiroya Okuma<br>
<br>
2019/12/14 12:46、Lixia Zhang <<a href="mailto:lixia@cs.ucla.edu" target="_blank">lixia@cs.ucla.edu</a>>のメール:<br>
<br>
> In the above you developed an interesting scenario.<br>
> Here is my view: we need to clarify the assumption here.<br>
> Although NDN uses app names to fetch data, one needs to keep in mind that routers/forwarders do not understand the name semantics, they forward interests and data packets by matching the binary strings of the names.<br>
> <br>
> for example the prefixes /prefix/A, /prefix/B, and /prefix/A+B are independent ones; a router would not know their relations.<br>
> So a router wont be able to perform any function based on its semantic understanding of the name "/prefix/A/%FE%00/prefix/A+B/%FE%00"<br>
> <br>
> I believe you need to write your own application to do that<br>
<br>
<br>
<br>
_______________________________________________<br>
ndnSIM mailing list<br>
<a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br>
<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Bien cordialement.</div>Mr DJAMA Adel.<div>Ecole Nationale Superieure d'Informatique - Oued smar, Alger, Algérie.</div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Bien cordialement.</div>Mr DJAMA Adel.<div>Ecole Nationale Superieure d'Informatique - Oued smar, Alger, Algérie.</div></div></div>