[ndnSIM] How to access node from forwarder

DJEMAA Adel a_djemaa at esi.dz
Mon Nov 16 01:21:20 PST 2020


Additionally to Spyridon reply, you can obtain ID of the node in
Forwerder.cpp by including the following libraries :

*#include <ns3/simulator.h>
#include <ns3/node-list.h>
#include <ns3/node.h>*

Then, the ID of the node can be obtained as follows:

*auto node = ns3::NodeList::GetNode(ns3::Simulator::GetContext());
std::cout<<" Node ID : "<<node->GetId();*

Hope this helps.

Sincerely,


Le lun. 16 nov. 2020 à 02:12, Eric Binnendyk via ndnSIM <
ndnsim at lists.cs.ucla.edu> a écrit :

> Hi,
>
> I modified forwarder.cpp with the following code to delete PIT entries
> when the PIT size gets too large (over 500 entries):
>
> if (m_pit.size() > 500) {
> int size = m_pit.size();
> int rand_entry_num = randomN(size);
> int i = 0;
> for (auto entry = m_pit.begin(); entry != m_pit.end(); ++entry) {
> if (i == rand_entry_num) {
> // interest already has PIT entry, but calling insert() obtains the shared
> ptr
> // see
> https://www.lists.cs.ucla.edu/pipermail/ndnsim/2015-December/002279.html
> std::shared_ptr<nfd::pit::Entry> sharedEntry = m_pit.insert(entry->
> getInterest()).first;
> this->setExpiryTimer(sharedEntry, 0_ms);
> std::cout << "Dropping PIT entry " << sharedEntry->getInterest().getName
> ().getPrefix(1) << std::endl;
> break;
> }
> i++;
> }
>
>
> 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.
>
> How do I access the Node object from the Forwarder class? Or is there a
> better way to do this logging?
>
> Eric
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>


-- 
Mr DJAMA Adel
Phd student
Ecole Militaire Polytechnique
Algiers 16046, ALGERIA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20201116/aba281f9/attachment.html>


More information about the ndnSIM mailing list