[ndnSIM] Sending a custom Interest

Michał Król mharnen at gmail.com
Wed Apr 26 04:01:14 PDT 2017


To use sendInterest function I need a corresponding PIT entry and I 
don't have it for an interest I've just created. It's possible to create 
it "manually", but m_forwarder giving access to the PIT table is private 
in the base Strategy class (I wonder if it's for a reason ;).

Anyway, I changed it to protected and it works. Just not sure if it's 
the best way to do it.

Thank you for your help!

Michał


On 26/04/17 03:20, Spyridon (Spyros) Mastorakis wrote:
> Hi,
>
> you should be able to use the SendInterest method directly from the 
> afterReceiveInterest callback of your strategy to send out the 
> Interests that you need.
>
> Just make sure that there is a FIB entry for the appropriate name.
>
> Thanks,
>
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/ 
> <http://cs.ucla.edu/%7Emastorakis/>
> Internet Research Laboratory
> Computer Science Department
> UCLA
>
>> On Apr 24, 2017, at 11:08 PM, Michał Król <mharnen at gmail.com 
>> <mailto:mharnen at gmail.com>> wrote:
>>
>> Hi Spyridon,
>>
>> thank you for your answer. I've read both before starting my 
>> strategy. However, I don't see anything concerning creating and 
>> sending a custom interest (not the one passed by the forwarder) from 
>> the strategy. Am I missing something?
>>
>>
>> On 25/04/17 01:22, Spyridon (Spyros) Mastorakis wrote:
>>> Hi,
>>>
>>> please take a look at the related documentation:
>>>
>>> http://ndnsim.net/2.3/helpers.html#forwarding-strategy
>>> http://ndnsim.net/2.3/fw.html#writing-your-own-custom-strategy
>>>
>>> Thanks,
>>>
>>> Spyridon (Spyros) Mastorakis
>>> Personal Website: http://cs.ucla.edu/~mastorakis/ 
>>> <http://cs.ucla.edu/%7Emastorakis/>
>>> Internet Research Laboratory
>>> Computer Science Department
>>> UCLA
>>>
>>>> On Apr 24, 2017, at 7:50 AM, Michał Król <mharnen at gmail.com 
>>>> <mailto:mharnen at gmail.com>> wrote:
>>>>
>>>> Dear All,
>>>>
>>>> I'm trying to send a new Interest packet from my forwarding 
>>>> strategy (for signaling reasons). So after I get an interest for 
>>>> data I forward it, and want to generate and broadcast another one 
>>>> to my neighbors.
>>>>
>>>> I tried to modify the code from ndn-app.cpp as that's the only 
>>>> "example" I found. However, the interest is not passed to the 
>>>> Forwarder and I'm not sure how to do it. The callback 
>>>> "afterSendInterest" is invoked.
>>>>
>>>> I'm wondering if I can use "NullTransport" for that (as it's done 
>>>> for ndn-app) or I need a different one?
>>>>
>>>> Is it the right way to implement a signaling protocol in my 
>>>> forwarding strategy?
>>>>
>>>> I would be grateful for any advices/comments.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Michał Król
>>>>
>>>>
>>>>
>>>> //create and add a face
>>>>
>>>>  auto genericLink = make_unique<nfd::face::GenericLinkService>();
>>>>  auto transport = 
>>>> make_unique<ns3::ndn::NullTransport>("appFace://", "appFace://",
>>>> ::ndn::nfd::FACE_SCOPE_LOCAL);
>>>>  m_face = std::make_shared<Face>(std::move(genericLink), 
>>>> std::move(transport));
>>>>  m_genericLinkService = 
>>>> static_cast<nfd::face::GenericLinkService*>(m_face->getLinkService());
>>>>  m_face->setMetric(1);
>>>>  m_forwarder.addFace(m_face);
>>>>
>>>>
>>>> //connect callbacks
>>>>  m_genericLinkService->afterReceiveData.connect([this] (Data data) {
>>>>                      onData(data);
>>>>                        });
>>>>
>>>>  m_genericLinkService->afterSendInterest.connect([this] (Interest 
>>>> interest) {
>>>>                      afterInterest(interest);
>>>>                        });
>>>>
>>>>
>>>> //send an interest
>>>>
>>>>  shared_ptr<Name> name = make_shared<Name>("/signaling");
>>>>  shared_ptr<Interest> interest = make_shared<Interest>();
>>>>  interest->setName(*name);
>>>>
>>>>  m_genericLinkService->sendInterest(*interest);
>>>>
>>>>
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170426/6342a7bb/attachment.html>


More information about the ndnSIM mailing list