UNPKG

ndn-js-contrib

Version:

Reusable 'Classes' for Named Data Networking: NameTree, PIT, FIB, ContentStore, Interfaces, and Transports

32 lines (25 loc) 829 B
var Name = require("ndn-js/js/name.js").Name; function Manager(){ return this; } var ADD_NEXTHOP = new Name("/localhop/nfd/rib/register"); var PEER_ANNOUNCE = new Name("/localhop/nfd/peer/connect"); var REGISTER_ID = new Name("/localhop/nfd/id/register"); var GET_NEXTHOPS = new Name("/localhop/nfd/rib/query"); var LOCALHOP = new Name("localhop") Manager.prototype.intercept = function Manager_intercept(interest, face){ if (ADD_NEXTHOP.match(interest.name)) return "add_nexthop"; else if (PEER_ANNOUNCE.match(interest.name)) return "peer_aware"; else if (GET_NEXTHOPS.match(interest.name)) return "get_nexthops"; else if (LOCALHOP.match(interest.name)) return "register_id"; else if (LOCALHOP.match(interest.name)) return "drop"; else { return false; } } module.exports = Manager;