<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><p>I created a function to retrieve the node name by mapping an <code>nfd::Forwarder</code>to the corresponding ns-3 node. First, I iterate through all nodes in <code>ns3::NodeList</code>, find the node that is running this forwarder, and then retrieve its name. The key part of the function looks like this:<br></p><div><code><span>ns3::Ptr<ns3::ndn::L3Protocol> l3proto = node-><span>GetObject</span><ns3::ndn::L3Protocol>();
</span></code><br></div><div><code><span><span>if</span> (l3proto) {
nfd::Forwarder* fwd = l3proto-><span>getForwarder</span>().<span>get</span>();
</span></code><br></div><div><code><span> <span>if</span> (fwd == thisFwd) {
std::string name = ns3::Names::<span>FindName</span>(node);
}
}
</span></code><br></div>
<p>I also made another change in the forwarder. The original function signature used <code>FaceEndpoint ingress</code>, which takes all faces as input. I modified it to <code>nfd::face::Face&</code> to allow handling individual faces of nodes.<br></p>
<p>By the way, thanks for your help! Everything is working well now.<br></p><div><br></div><p>March 4, 2025 at 8:18 AM, "DJEMAA Adel" <<a href="mailto:a_djemaa@esi.dz?to=%22DJEMAA%20Adel%22%20%3Ca_djemaa%40esi.dz%3E" target="_blank" tabindex="-1">a_djemaa@esi.dz</a>> wrote:<br></p><blockquote><div dir="ltr">Dear Mohammad,<div>Try this code to retrieve node names in Forwader.cpp file:<br></div><div>auto node = ns3::NodeList::GetNode(ns3::Simulator::GetContext());<br></div><div>std::cout<<" ************ Node ID :****************"<< node->GetId() <<std::endl;<br></div><div>You need to include these: <br></div><div>#include <ns3/node-list.h><br></div>#include <ns3/node.h><div>Let us know if this answers your question.<br></div><div>kind regards;<br></div></div><div><br></div><div><div dir="ltr">Le lun. 3 mars 2025 à 16:49, Mohammad R. Shakournia via ndnSIM <<a href="mailto:ndnsim@lists.cs.ucla.edu" target="_blank" tabindex="-1">ndnsim@lists.cs.ucla.edu</a>> a écrit :<br></div><blockquote style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><u></u><div><p>Dear ndnSIM community,<br></p><p>I am currently working on measuring CS and PIT lookup times in <b>Forwarder.cpp</b> by using a clock in the <b>onIncomingInterest</b> function. I log these measurements to separate output files for each node. However, I am facing an issue:<br></p><ol><li>The node names are <b>not appearing</b> in my output files.<br></li><li>When using tracers like <b>L3Tracer</b>, multiple faces are assigned to each node, making it difficult to map <b>faceId</b> to the corresponding <b>node name</b>, even with explicit mapping.<br></li></ol><p>I tried retrieving node names using <code>ns3::Names::FindName(node)</code>, but it does not always return the expected results. Could you please guide me on how to correctly obtain the <b>node name</b> in <b>Forwarder.cpp</b> and include it in my output logs?<br></p><p>Any insights or suggestions would be greatly appreciated.<br></p><p>Best regards,<br></p><div><br></div>Mohammad Reza Shakournia<p><br></p><div><br></div></div>_______________________________________________<div><br></div>
ndnSIM mailing list<div><br></div>
<a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank" tabindex="-1">ndnSIM@lists.cs.ucla.edu</a><div><br></div>
<a href="https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" target="_blank" tabindex="-1">https://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><div><br></div>
</blockquote></div><div><br></div><div><br></div><span>-- </span><div><br></div><div dir="ltr"><div dir="ltr"><div>Mr DJAMA Adel<br></div><div>Phd<br></div><div>Ecole Militaire Polytechnique<br></div><div>Algiers 16046, ALGERIA<br></div></div></div></blockquote><div><br></div></body></html>