[ndnSIM] the face of a node
Atif Rehman
atif_r at outlook.com
Sun Jul 21 00:52:07 PDT 2019
Hello Bouchrit,
I think you are looking for the following code.
// Following includes are mandatory in order to get node and its faces
#include <ns3/node-list.h>
#include <ns3/node.h>
#include "../../../model/ndn-l3-protocol.hpp"
// Code
if (ns3::Simulator::GetContext() < 1000) // this check prevents 4535459 value of Context, I am not sure why it returns 4535459
{
ns3::Ptr<ns3::Node> node = ns3::NodeList::GetNode(ns3::Simulator::GetContext()); // Get Current node from simulator context
ns3::Ptr<ns3::ndn::L3Protocol> l3Object = node->GetObject<ns3::ndn::L3Protocol>(); // Getting l3 Object
std::cout << "Node Id :" << node->GetId() << std::endl;
// iteratation over face table
for (auto & face : l3Object->getForwarder()->getFaceTable())
{
// here you can play with "face" object (current node face)
}
}
I executed the above code in Forwarder class and it was working fine for me.
Regards
Muhammad Atif Ur Rehman (Ph.D. Student)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20190721/b01dfb02/attachment.html>
More information about the ndnSIM
mailing list