[Ndn-interest] Delay forwarding in fw strategy
Adhy Satya
adhysatya820 at gmail.com
Mon Jul 17 11:19:56 PDT 2017
Dear Junxiao,
I'm following the instructions you posted a few days ago (
http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html) but
I'm not sure how to schedule the event. The NCC strategy does something
similar I believe.
Here's my code:
// my-strategy.cpp
void
MyStrategy::afterReceiveInterest(const Face& inFace, const Interest&
interest,
const
shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_INFO(interest << " from=" << inFace.getId());
<some calculations>
meanWaiting = calculatedDelay; // timer for delaying Interest packets
const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
const fib::NextHopList& nexthops = fibEntry.getNextHops();
PitEntryInfo* pitEntryInfo =
pitEntry->insertStrategyInfo<PitEntryInfo>().first;
for (fib::NextHopList::const_iterator it = nexthops.begin(); it !=
nexthops.end(); ++it) {
Face& outFace = it->getFace();
if (canForwardToLegacy(*pitEntry, outFace)) {
this->sendInterest(pitEntry, outFace);
// Not sure how to assign an event
pitEntryInfo->deferTimer = scheduler::schedule(meanWaiting, ???);
}
}
if (!hasPendingOutRecords(*pitEntry)) {
this->rejectPendingInterest(pitEntry);
}
}
~~~~~~~~~~~~~~~~~~
// my-strategy.hpp
class MyStrategy : public Strategy
{
public:
MyStrategy (Forwarder& forwarder, const Name& name = STRATEGY_NAME);
virtual void
afterReceiveInterest(const Face& inFace, const Interest& interest,
const shared_ptr<pit::Entry>& pitEntry) override;
public:
static const Name STRATEGY_NAME;
/// StrategyInfo on pit::Entry
class PitEntryInfo : public StrategyInfo
{
public:
static constexpr int
getTypeId()
{
return 9001;
}
virtual
~PitEntryInfo() override;
public:
scheduler::EventId deferTimer;
time::nanoseconds meanWaiting; // Wait period before rebroadcasting
};
};
} // namespace fw
} // namespace nfd
Can you help please?
Thank you
On Mon, Jul 17, 2017 at 9:59 AM, Adhy Satya <adhysatya820 at gmail.com> wrote:
> Hi Klaus,
>
> I'm working on a wireless scenario (my apologies! I forgot to clarify this
> in my first email).
> - Point 1 (Send the Data to a different interface): nodes will broadcast
> packets on the same interface (WiFi);
> - Point 2 (Delay the Data packet): 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 NDN Car2Car
> <https://github.com/cawka/ndnSIM-nom-rapid-car2car/blob/master/extensions/ndn-fw-v2v.cc>
> 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.
>
>
>
>
>
> On Fri, Jul 14, 2017 at 11:19 AM, Klaus Schneider <klaus at cs.arizona.edu>
> wrote:
>
>>
>>
>> On 07/13/2017 08:47 PM, Adhy Satya wrote:
>>
>>> Hi Junxiao,
>>>
>>> Thank you for your answer. I missed that detail on the NFD developer
>>> guide (that the strategy controls only Interests packets).
>>> 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.
>>>
>>
>> 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:
>>
>> 1. Send the Data to a different interface. Or
>>
>> 2. Delay the Data packet.
>>
>> Was this feature ever implemented? (it shows as 0% done in issue 3333 <
>>> https://redmine.named-data.net/issues/3333>). Are there any sample
>>> implementations?
>>>
>>
>> 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.
>>
>> However, the strategy was not designed that way (presumably) because
>> nobody saw a use case.
>>
>> For (1): why would anyone want to send the Data to a different face? It
>> would be dropped there as "unsolicited".
>>
>> For (2): why do you want to delay the Data inside the strategy? Maybe
>> there's an easier solution for you like
>>
>> - delaying Data/Interests at consumer or producer. Or
>> - delaying the Interests inside the strategy.
>>
>>
>> Best regards,
>> Klaus
>>
>>
>>
>>
>>
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Jul 13, 2017 at 4:45 PM, Junxiao Shi <
>>> shijunxiao at email.arizona.edu <mailto:shijunxiao at email.arizona.edu>>
>>> wrote:
>>>
>>> Hi Adhy
>>>
>>> The method to delay Interest forwarding is explained in this answer:
>>> http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html
>>> <http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003952.html
>>> >
>>> Forwarding strategy does not have control over Data forwarding nor
>>> can it delay Data forwarding. The reason is explained in this
>>> answer:
>>> http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003961.html
>>> <http://www.lists.cs.ucla.edu/pipermail/ndnsim/2017-July/003961.html
>>> >
>>> Also, you need to ensure your Interest name (including any “extra
>>> name components”) is a prefix of the Data name. Otherwise, Data does
>>> not satisfy Interest and will not be received by the consumer.
>>>
>>> Yours, Junxiao
>>>
>>> On Jul 13, 2017, at 11:43 AM, Adhy Satya <adhysatya820 at gmail.com
>>>> <mailto:adhysatya820 at gmail.com>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> My consumer and producer applications send Interest and Data
>>>> packets with extra name components. I wrote a custom forwarding
>>>> strategy that reads this name components and forward packets with
>>>> certain delay.
>>>>
>>>> I'm using NFD 0.5.0 and ndn-cxx 0.5.0. I'm unsure where to
>>>> implement the timer. It seems that if I implement a timer to call
>>>> "this->sendInterest()" it will block the forwarder for a certain
>>>> amount of time.
>>>>
>>>> Can you assist me on this issue please?
>>>>
>>>> Thank you
>>>> _______________________________________________
>>>> Ndn-interest mailing list
>>>> Ndn-interest at lists.cs.ucla.edu <mailto:Ndn-interest at lists.cs.
>>>> ucla.edu>
>>>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest
>>>> <http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest>
>>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Ndn-interest mailing list
>>> Ndn-interest at lists.cs.ucla.edu
>>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest
>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-interest/attachments/20170717/fa414b05/attachment-0001.html>
More information about the Ndn-interest
mailing list