[ndnSIM] Getting the node's object

John Baugh jpbaugh at umich.edu
Sat Jun 3 11:16:31 PDT 2017


Have you tried:

this->getObject<Node>()

On Jun 3, 2017 9:12 AM, "Mateus Sousa" <mateus.aluufc at gmail.com> wrote:

> Hi,
>
> I'm stuck on the following problem:
> I'm creating a new forwarding method and I need to get the node's object
> to make some decisions. My method seems much like this
> (multicast-strategy.cpp):
>
> #include "multicast-strategy.hpp"
> #include "algorithm.hpp"
>
> namespace nfd {
> namespace fw {
>
> const Name MulticastStrategy::STRATEGY_NAME("ndn:/localhost/nfd/
> strategy/multicast/%FD%01");
> NFD_REGISTER_STRATEGY(MulticastStrategy);
>
> MulticastStrategy::MulticastStrategy(Forwarder& forwarder, const Name&
> name)
>   : Strategy(forwarder, name)
> {
> }
>
> void
> MulticastStrategy::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();
>
>   for (fib::NextHopList::const_iterator it = nexthops.begin(); it !=
> nexthops.end(); ++it) {
>     Face& outFace = it->getFace();
>     if (!wouldViolateScope(inFace, interest, outFace) &&
>         canForwardToLegacy(*pitEntry, outFace)) {
>       this->sendInterest(pitEntry, outFace, interest);
>     }
>   }
>
>   if (!hasPendingOutRecords(*pitEntry)) {
>     this->rejectPendingInterest(pitEntry);
>   }
> }
>
> } // namespace fw
> } // namespace nfd
>
> I need a way to return the node's object or the node's ID.
>
> Thanks in advance.
>
> _______________________________________________
> 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/20170603/1682a2b8/attachment.html>


More information about the ndnSIM mailing list