[ndnSIM] Sending a custom Interest
Spyridon (Spyros) Mastorakis
mastorakis at cs.ucla.edu
Mon Apr 24 17:22:49 PDT 2017
Hi,
please take a look at the related documentation:
http://ndnsim.net/2.3/helpers.html#forwarding-strategy <http://ndnsim.net/2.3/helpers.html#forwarding-strategy>
http://ndnsim.net/2.3/fw.html#writing-your-own-custom-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/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA
> On Apr 24, 2017, at 7:50 AM, Michał Król <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/20170424/64a80f75/attachment.html>
More information about the ndnSIM
mailing list