<div dir="ltr">Additionally to Spyridon reply, you can obtain ID of the node in Forwerder.cpp by including the following libraries :<div><pre style="white-space:pre-wrap;font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:14px"><b><i>#include <ns3/simulator.h>
#include <ns3/node-list.h>
#include <ns3/node.h></i></b></pre></div><div><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><font face="arial, sans-serif">Then, the ID of the node can be obtained as follows:</font></pre><pre style="white-space:pre-wrap;font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:14px"><b><i>auto node = ns3::NodeList::GetNode(ns3::Simulator::GetContext());
std::cout<<" Node ID : "<<node->GetId();</i></b></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><font face="arial, sans-serif">Hope this helps.</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)"><font face="arial, sans-serif">Sincerely,</font></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 16 nov. 2020 à 02:12, Eric Binnendyk via ndnSIM <<a href="mailto:ndnsim@lists.cs.ucla.edu">ndnsim@lists.cs.ucla.edu</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>Hi,</div><div><br></div><div>I modified forwarder.cpp with the following code to delete PIT entries when the PIT size gets too large (over 500 entries):</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(212,212,212)">  </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)"> (</span><span style="color:rgb(156,220,254)">m_pit</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">size</span><span style="color:rgb(212,212,212)">() > </span><span style="color:rgb(181,206,168)">500</span><span style="color:rgb(212,212,212)">) {</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(86,156,214)">int</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">size</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(156,220,254)">m_pit</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">size</span><span style="color:rgb(212,212,212)">();</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(86,156,214)">int</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">rand_entry_num</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(220,220,170)">randomN</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">size</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(86,156,214)">int</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">i</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(197,134,192)">for</span><span style="color:rgb(212,212,212)"> (</span><span style="color:rgb(86,156,214)">auto</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">entry</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(156,220,254)">m_pit</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">begin</span><span style="color:rgb(212,212,212)">(); </span><span style="color:rgb(156,220,254)">entry</span><span style="color:rgb(212,212,212)"> != </span><span style="color:rgb(156,220,254)">m_pit</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">end</span><span style="color:rgb(212,212,212)">(); ++</span><span style="color:rgb(156,220,254)">entry</span><span style="color:rgb(212,212,212)">) {</span></div><div><span style="color:rgb(212,212,212)">      </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)"> (</span><span style="color:rgb(156,220,254)">i</span><span style="color:rgb(212,212,212)"> == </span><span style="color:rgb(156,220,254)">rand_entry_num</span><span style="color:rgb(212,212,212)">) {</span></div><div><span style="color:rgb(106,153,85)">        // interest already has PIT entry, but calling insert() obtains the shared ptr</span></div><div><span style="color:rgb(106,153,85)">        // see <a href="https://www.lists.cs.ucla.edu/pipermail/ndnsim/2015-December/002279.html" target="_blank">https://www.lists.cs.ucla.edu/pipermail/ndnsim/2015-December/002279.html</a></span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(212,212,212)">::</span><span style="color:rgb(78,201,176)">shared_ptr</span><span style="color:rgb(212,212,212)"><</span><span style="color:rgb(78,201,176)">nfd</span><span style="color:rgb(212,212,212)">::</span><span style="color:rgb(78,201,176)">pit</span><span style="color:rgb(212,212,212)">::Entry> </span><span style="color:rgb(156,220,254)">sharedEntry</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(156,220,254)">m_pit</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">insert</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">entry</span><span style="color:rgb(212,212,212)">-></span><span style="color:rgb(220,220,170)">getInterest</span><span style="color:rgb(212,212,212)">()).</span><span style="color:rgb(156,220,254)">first</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(86,156,214)">this</span><span style="color:rgb(212,212,212)">-></span><span style="color:rgb(220,220,170)">setExpiryTimer</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">sharedEntry</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(181,206,168)">0_ms</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(212,212,212)">::cout << </span><span style="color:rgb(206,145,120)">"Dropping PIT entry "</span><span style="color:rgb(212,212,212)"> << </span><span style="color:rgb(156,220,254)">sharedEntry</span><span style="color:rgb(220,220,170)">-></span><span style="color:rgb(220,220,170)">getInterest</span><span style="color:rgb(212,212,212)">().</span><span style="color:rgb(220,220,170)">getName</span><span style="color:rgb(212,212,212)">().</span><span style="color:rgb(220,220,170)">getPrefix</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(181,206,168)">1</span><span style="color:rgb(212,212,212)">) << </span><span style="color:rgb(78,201,176)">std</span><span style="color:rgb(212,212,212)">::</span><span style="color:rgb(220,220,170)">endl</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(197,134,192)">break</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(212,212,212)">      }</span></div><div><span style="color:rgb(212,212,212)">      </span><span style="color:rgb(156,220,254)">i</span><span style="color:rgb(212,212,212)">++;</span></div><div><span style="color:rgb(212,212,212)">    }</span></div><div><span style="color:rgb(106,153,85)"><br></span></div></div></div><div><br></div><div>I would like to be able to log which interests get dropped, on a certain node, in order to determine the distribution of interests stored on that node's PIT. But I need to find some way to obtain the identity of the node, which I assume I should do via the Node object.<br></div><div><br></div><div>How do I access the Node object from the Forwarder class? Or is there a better way to do this logging?<br></div><div><br></div><div>Eric<br></div></div>
_______________________________________________<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" class="gmail_signature"><div dir="ltr"><div>Mr DJAMA Adel<br></div><div>Phd student </div><div>Ecole Militaire Polytechnique</div><div>Algiers 16046, ALGERIA</div></div></div>