<div dir="ltr">Dear Junxiao,<div><br></div><div>I'm following the instructions you posted a few days ago (<a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html">http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html</a>) but I'm not sure how to schedule the event. The NCC strategy does something similar I believe.</div><div>Here's my code:</div><div><br></div><div>// my-strategy.cpp</div><div><br></div><div>    void</div><div>    MyStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,</div><div>                                                         const shared_ptr<pit::Entry>& pitEntry)</div><div>    {</div><div>    NFD_LOG_INFO(interest << " from=" << inFace.getId());</div><div>    </div><div>    <some calculations></div><div><br></div><div>    meanWaiting = calculatedDelay;    // timer for delaying Interest packets</div><div><br></div><div><div>    const fib::Entry& fibEntry = this->lookupFib(*pitEntry);</div><div>    const fib::NextHopList& nexthops = fibEntry.getNextHops();</div></div><div><br></div><div>    PitEntryInfo* pitEntryInfo = pitEntry->insertStrategyInfo<PitEntryInfo>().first;</div><div><br></div><div>    for (fib::NextHopList::const_iterator it = nexthops.begin(); it != nexthops.end(); ++it) {</div><div>    Face& outFace = it->getFace();</div><div>    if (canForwardToLegacy(*pitEntry, outFace)) {</div><div>      this->sendInterest(pitEntry, outFace);</div><div><br></div><div>      // Not sure how to assign an event</div><div>      pitEntryInfo->deferTimer = scheduler::schedule(meanWaiting, ???);</div><div>    }</div><div>  }</div><div><br></div><div>  if (!hasPendingOutRecords(*pitEntry)) {</div><div>    this->rejectPendingInterest(pitEntry);</div><div>  }</div><div>}</div><div>~~~~~~~~~~~~~~~~~~</div><div>// my-strategy.hpp<br></div><div><br></div><div><div>class MyStrategy : public Strategy</div><div>{</div><div>public:<br></div><div>  MyStrategy (Forwarder& forwarder, const Name& name = STRATEGY_NAME);</div><div><br></div><div>  virtual void</div><div>  afterReceiveInterest(const Face& inFace, const Interest& interest,</div><div>                       const shared_ptr<pit::Entry>& pitEntry) override;</div><div><br></div><div>public:</div><div>  static const Name STRATEGY_NAME;</div><div><br></div><div>  /// StrategyInfo on pit::Entry</div><div>  class PitEntryInfo : public StrategyInfo</div><div>  {</div><div>  public:</div><div>    static constexpr int</div><div>    getTypeId()</div><div>    {</div><div>      return 9001;</div><div>    }</div><div><br></div><div>    virtual</div><div>    ~PitEntryInfo() override;</div><div><br></div><div>  public:</div><div>    scheduler::EventId deferTimer;</div><div><div>    time::nanoseconds meanWaiting; // Wait period before rebroadcasting</div></div><div>  };</div><div><br></div><div>};</div><div><br></div><div>} // namespace fw</div><div>} // namespace nfd</div></div><div><br></div><div><br></div><div>Can you help please?</div><div><br></div><div>Thank you</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 17, 2017 at 9:59 AM, Adhy Satya <span dir="ltr"><<a href="mailto:adhysatya820@gmail.com" target="_blank">adhysatya820@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Klaus,<div><br></div><div>I'm working on a wireless scenario (my apologies! I forgot to clarify this in my first email).</div><div>- Point 1 (<span style="font-size:12.8px">Send the Data to a different interface</span>): nodes will broadcast packets on the same interface (WiFi);</div><div>- Point 2 (<span style="font-size:12.8px">Delay the Data packet</span>): since wireless is broadcast in nature, all nodes in the communication range will listen to Interest/Data transmissions and will rebroadcast roughly at the same time. Delayed retransmissions help to avoid collisions in the wireless channel. This technique was used in the <a href="https://github.com/cawka/ndnSIM-nom-rapid-car2car/blob/master/extensions/ndn-fw-v2v.cc" target="_blank">NDN Car2Car</a> work (ndnSIM) and other works, but I think they all used simulators. In the Car2Car, the delay was performed in a customized face, not in the strategy.</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 14, 2017 at 11:19 AM, Klaus Schneider <span dir="ltr"><<a href="mailto:klaus@cs.arizona.edu" target="_blank">klaus@cs.arizona.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><br>
<br>
On 07/13/2017 08:47 PM, Adhy Satya wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi Junxiao,<br>
<br>
Thank you for your answer. I missed that detail on the NFD developer guide (that the strategy controls only Interests packets).<br>
In my case, each data packet is associated with a unique Interest; therefore, by adopting an Interest digest the strategy should be able to control Data packets. <br>
</blockquote>
<br></span>
You can use the function beforeSatisfyInterest() that is called whenever a Data packet arrives. Thus you can perform certain actions (like storing RTT measurements) on each Data packet. You just cannot:<br>
<br>
1. Send the Data to a different interface. Or<br>
<br>
2. Delay the Data packet.<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Was this feature ever implemented? (it shows as 0% done in issue 3333 <<a href="https://redmine.named-data.net/issues/3333" rel="noreferrer" target="_blank">https://redmine.named-data.ne<wbr>t/issues/3333</a>>). Are there any sample implementations?<br>
</blockquote>
<br>
One could design the strategy so that beforeSatisfyInterest() is a mandatory step in the pipeline between "incoming Data" and "outgoing Data". This would extend the functionality and probably support what you want.<br>
<br>
However, the strategy was not designed that way (presumably) because nobody saw a use case.<br>
<br>
For (1): why would anyone want to send the Data to a different face? It would be dropped there as "unsolicited".<br>
<br>
For (2): why do you want to delay the Data inside the strategy? Maybe there's an easier solution for you like<br>
<br>
- delaying Data/Interests at consumer or producer. Or<br>
- delaying the Interests inside the strategy.<br>
<br>
<br>
Best regards,<br>
Klaus<br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
Thanks<span><br>
<br>
<br>
<br>
<br>
<br>
On Thu, Jul 13, 2017 at 4:45 PM, Junxiao Shi <<a href="mailto:shijunxiao@email.arizona.edu" target="_blank">shijunxiao@email.arizona.edu</a> <mailto:<a href="mailto:shijunxiao@email.arizona.edu" target="_blank">shijunxiao@email.arizo<wbr>na.edu</a>>> wrote:<br>
<br>
    Hi Adhy<br>
<br>
    The method to delay Interest forwarding is explained in this answer:<br>
    <a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/p<wbr>ipermail/ndnsim/2017-July/0039<wbr>52.html</a><br>
    <<a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/<wbr>pipermail/ndnsim/2017-July/003<wbr>952.html</a>><br>
    Forwarding strategy does not have control over Data forwarding nor<br>
    can it delay Data forwarding. The reason is explained in this<br>
    answer:<br>
    <a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003961.html" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/p<wbr>ipermail/ndnsim/2017-July/0039<wbr>61.html</a><br>
    <<a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003961.html" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/<wbr>pipermail/ndnsim/2017-July/003<wbr>961.html</a>><br>
    Also, you need to ensure your Interest name (including any “extra<br>
    name components”) is a prefix of the Data name. Otherwise, Data does<br>
    not satisfy Interest and will not be received by the consumer.<br>
<br>
    Yours, Junxiao<br>
<br>
</span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
    On Jul 13, 2017, at 11:43 AM, Adhy Satya <<a href="mailto:adhysatya820@gmail.com" target="_blank">adhysatya820@gmail.com</a><br></span><span>
    <mailto:<a href="mailto:adhysatya820@gmail.com" target="_blank">adhysatya820@gmail.com</a><wbr>>> wrote:<br>
<br>
    Hi,<br>
<br>
    My consumer and producer applications send Interest and Data<br>
    packets with extra name components. I wrote a custom forwarding<br>
    strategy that reads this name components and forward packets with<br>
    certain delay.<br>
<br>
    I'm using NFD 0.5.0 and ndn-cxx 0.5.0. I'm unsure where to<br>
    implement the timer. It seems that if I implement a timer to call<br>
    "this->sendInterest()" it will block the forwarder for a certain<br>
    amount of time.<br>
<br>
    Can you assist me on this issue please?<br>
<br>
    Thank you<br>
    ______________________________<wbr>_________________<br>
    Ndn-interest mailing list<br></span>
    <a href="mailto:Ndn-interest@lists.cs.ucla.edu" target="_blank">Ndn-interest@lists.cs.ucla.edu</a> <mailto:<a href="mailto:Ndn-interest@lists.cs.ucla.edu" target="_blank">Ndn-interest@lists.cs.<wbr>ucla.edu</a>><br>
    <a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/m<wbr>ailman/listinfo/ndn-interest</a><br>
    <<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/<wbr>mailman/listinfo/ndn-interest</a>><br>
</blockquote><span>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Ndn-interest mailing list<br>
<a href="mailto:Ndn-interest@lists.cs.ucla.edu" target="_blank">Ndn-interest@lists.cs.ucla.edu</a><br>
<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/m<wbr>ailman/listinfo/ndn-interest</a><br>
<br>
</span></blockquote>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>