[ndnSIM] Get node id in forwarding strategy

Alex Afanasyev aa at cs.fiu.edu
Wed Jun 13 18:59:05 PDT 2018



> On Jun 13, 2018, at 8:33 PM, Adhy Satya <adhysatya820 at gmail.com <mailto:adhysatya820 at gmail.com>> wrote:
> 
> Hi,
> 
> I wrote a custom fw-strategy where I get the node ID like so:
> 
> void
> BroadcastStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,const shared_ptr<pit::Entry>& pitEntry)
> {
>   const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
>   const fib::NextHopList& nexthops = fibEntry.getNextHops();
> 
> 
>   ns3::Ptr<ns3::Node> node = ns3::NodeList::GetNode(ns3::Simulator::GetContext());
>   ns3::Ptr<ns3::NetDevice> netDevice;
>   ns3::Ptr<ns3::ndn::L3Protocol> ndnl3;
>   ndnl3 = node->GetObject<ns3::ndn::L3Protocol>();
> 
> 
> The issue is that I'm getting the exact same error as this post from Oct 2017 <http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-October/004175.html>. There are several other posts with the same issue, some want to get the node id in the lru-cache, etc. However, all these posts seem to be scheduling an event, then getting with Simulator::GetContext().
> 
> I can't apply the solution from this posts in my case, since I don't call Simulator::ScheduleWithContext(). I just want to get the id of the node that is processing the Interest.
> 
> Is there another option to this?

Whether you're scheduling with context or not, events are executed in the context.  afterReceiveInterest will be executed in the context of the node, so the solution from the old post still works.

--
Alex

> 
> I'm using ndnSIM 2.5
> 
> Thank you!
> Adhy
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu <mailto:ndnSIM at lists.cs.ucla.edu>
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

______________
Alex Afanasyev
Assistant Professor, SCIS, Florida International University
11200 SW 8th Street, ECS Room 261B, Miami, FL 33199
phone: +1.305.348.4960 (office); email: aa at cs.fiu.edu <mailto:aa at cs.fiu.edu>
web: https://users.cs.fiu.edu/~afanasyev/ <https://users.cs.fiu.edu/~afanasyev/>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180613/d7b10d78/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 873 bytes
Desc: Message signed with OpenPGP
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180613/d7b10d78/attachment-0001.sig>


More information about the ndnSIM mailing list