<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 15, 2018, at 1:06 PM, Mudasir Qazi <<a href="mailto:mudasirqazi00@gmail.com" class="">mudasirqazi00@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class="">Hi, <br class=""><br class=""></div>I am looking for the ID of a node in the network. I want to know which node has sent interest or data etc.<br class=""><br class=""></div>I have found following way to get it in <i class="">ndn-app-link-service.cpp </i>class, and it works fine because this class has <i class="">m_node</i> private member.<br class=""><br class="">uint32_t nodeId = m_node->GetId(); //works fine in <i class="">ndn-app-link-service.cpp</i><br class=""><br class=""></div>But, the problem is, I also need to get Node ID in <i class="">forwarder.cpp </i>as well as on several other places in whole ndnSIM. I have tried following method to get it in <i class="">forwarder.cpp</i> but it does not work.<br class=""><br class=""></div>//does not work in forwarder.cpp<br class=""><div class="">ns3::Ptr<ns3::Application> app = ns3::Ptr<ns3::Application>();<br class=""></div></div></div></blockquote><div>the above is pointless-- you're creating nullptr and then trying to dereference.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">ns3::Ptr<ns3::Node> node = app->GetNode();<br class="">uint32_t nodeId = node->GetId();</div></div></div></blockquote><div><br class=""></div><div>You can use simulator context to get access to the node (same as in ndn-cxx/src/face.cpp on line 98):</div><div><br class=""></div><div>ns3::Ptr<ns3::Node> node = ns3::NodeList::GetNode(ns3::Simulator::GetContext());</div><div><br class=""></div><div>--</div><div>Alex</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><br class=""></div><div class="">Please guide me how can I get it in <i class="">forwarder.cpp</i> as well as give me a general method to get it wherever it is needed in whole ndnSIM for future purposes.<br class=""><br class=""><br class=""></div><div class="">-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><span style="font-family:georgia,serif" class="">Regards,<br class=""></span></div><div class=""><span style="font-family:georgia,serif" class="">Mudasir Qazi<br class=""></span></div></div></div></div></div></div></div></div></div>
</div></div></div></div></div></div>
_______________________________________________<br class="">ndnSIM mailing list<br class=""><a href="mailto:ndnSIM@lists.cs.ucla.edu" class="">ndnSIM@lists.cs.ucla.edu</a><br class=""><a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" class="">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br class=""></div></blockquote></div><br class=""><div class="">
<div dir="auto" style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">______________<br class="">Alex Afanasyev<br class="">Assistant Professor, SCIS, Florida International University<br class="">11200 SW 8th Street, ECS Room 261B, Miami, FL 33199<br class="">phone: +1.305.348.4960 (office); <a href="mailto:aa@cs.fiu.edu" class="">email: aa@cs.fiu.edu</a><br class="">web: <a href="https://users.cs.fiu.edu/~afanasyev/" class="">https://users.cs.fiu.edu/~afanasyev/</a><br class=""><br class=""></div></div></div>
</div>
<br class=""></body></html>