[ndnSIM] Sending a custom Interest
Michał Król
mharnen at gmail.com
Mon Apr 24 07:50:18 PDT 2017
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);
More information about the ndnSIM
mailing list