[ndnSIM] List all Installed Prefix on a Node from App

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Feb 25 11:53:03 PST 2015


Hi Hitesh,

You actually have several ways to do it.  The “right” way is to request so called FIB status dataset from NFD (http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset <http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset>).  However, given that ndnSIM is a simulator, you can do it directly:

Ptr<Node> node = ...
Ptr<ndn::L3Protocol> l3 = node->GetObject<ndn::L3Protocol>();
shared_ptr<nfd::Forwarder> fw = l3->getForwarder();
nfd::Fib& fib = fw->getFib();

for (const auto&& fibEntry : fib) {
  std::cout << " - “ << fibEntry.getPrefix() << std::endl;
  for (const auto&& nh : fibEntry.getNextHops()) {
    std::cout << "    - " << nh.getFace() << “, “ << nh.getFace().getId() << “, “ << nh.getCost() << std::endl;
  }
}

(I haven’t checked this code, so it may have some minor issues).

—
Alex

> On Feb 25, 2015, at 9:28 AM, Hitesh Wadekar <wadekahn at clarkson.edu> wrote:
> 
> Hey Guys,
> 
> How can I get all the installed prefix information on a node from application? For instance, I have a node object and I want to iterate all the prefix configured for the installed application on that node.
> 
> Thanks
> 
> Cheer,
> Hitesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20150225/6bbbe4f9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20150225/6bbbe4f9/attachment.bin>


More information about the ndnSIM mailing list