[ndnSIM] Get node id in forwarding strategy

John Baugh jpbaugh at umich.edu
Thu Jun 14 03:30:26 PDT 2018


I think using the Simulator::ScheduleWithContext would be the best, as Alex
just suggested.

However, what is the behavior if you tried something like:

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();

 *int contextVal = ns3::Simulator::GetContext();*

* if(contextVal != -1) *
* {*
*    ns3::Ptr<ns3::Node> node = ns3::NodeList::GetNode(contextVal);  *
    ns3::Ptr<ns3::NetDevice> netDevice;
    ns3::Ptr<ns3::ndn::L3Protocol> ndnl3;
    ndnl3 = node->GetObject<ns3::ndn::L3Protocol>();
 }


//...........

Thoughts?

John

On Wed, Jun 13, 2018 at 8:33 PM, Adhy Satya <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?
>
> I'm using ndnSIM 2.5
>
> Thank you!
> Adhy
>
>
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180614/87ddc50e/attachment.html>


More information about the ndnSIM mailing list