[ndnSIM] How to access node from forwarder

Spyridon Mastorakis smastorakis at unomaha.edu
Sun Nov 15 18:58:38 PST 2020


Hi,

Not sure if there is an easier way, but you can use the node list of ns3 (https://www.nsnam.org/doxygen/classns3_1_1_node_list.html) and iterate over all the nodes in the topology and for each node check if &(*node->GetObject<ns3::ndn::L3Protocol>()->getForwarder()) == &m_forwarder)

If that’s the case, you found the current node and you can print out its name.

Thanks,

Spyridon (Spyros) Mastorakis
Assistant Professor
Computer Science Department
University of Nebraska, Omaha
Peter Kiewit Institute Room 175A
https://sites.google.com/site/spyridonmastorakis

> On Nov 15, 2020, at 7:11 PM, Eric Binnendyk via ndnSIM <ndnsim at lists.cs.ucla.edu> wrote:
> 
> 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
> 



More information about the ndnSIM mailing list