const RegisteredPrefixId* Face::setInterestFilter(const InterestFilter& interestFilter, const OnInterest& onInterest, const RegisterPrefixFailureCallback& onFailure, const Name& identity, uint64_t flags) { security::SigningInfo signingInfo = signingByIdentity(identity); return setInterestFilter(interestFilter, onInterest, onFailure, signingInfo, flags); }
const RegisteredPrefixId* Face::setInterestFilter(const InterestFilter& interestFilter, const OnInterest& onInterest, const RegisterPrefixFailureCallback& onFailure, const IdentityCertificate& certificate, uint64_t flags) { security::SigningInfo signingInfo; if (!certificate.getName().empty()) { signingInfo = signingByCertificate(certificate.getName()); } return setInterestFilter(interestFilter, onInterest, onFailure, signingInfo, flags); }
const RegisteredPrefixId* Face::setInterestFilter(const InterestFilter& interestFilter, const OnInterest& onInterest, const RegisterPrefixFailureCallback& onFailure, const security::SigningInfo& signingInfo, uint64_t flags) { return setInterestFilter(interestFilter, onInterest, RegisterPrefixSuccessCallback(), onFailure, signingInfo, flags); }
void Node::nfdRegisterPrefix (uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterestCallback& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, KeyChain& commandKeyChain, const Name& commandCertificateName, WireFormat& wireFormat, Face* face) { if (!&commandKeyChain) throw runtime_error ("registerPrefix: The command KeyChain has not been set. You must call setCommandSigningInfo."); if (commandCertificateName.size() == 0) throw runtime_error ("registerPrefix: The command certificate name has not been set. You must call setCommandSigningInfo."); ControlParameters controlParameters; controlParameters.setName(*prefix); controlParameters.setForwardingFlags(flags); ptr_lib::shared_ptr<Interest> commandInterest(new Interest()); if (isLocal()) { commandInterest->setName(Name("/localhost/nfd/rib/register")); // The interest is answered by the local host, so set a short timeout. commandInterest->setInterestLifetimeMilliseconds(2000.0); } else { commandInterest->setName(Name("/localhop/nfd/rib/register")); // The host is remote, so set a longer timeout. commandInterest->setInterestLifetimeMilliseconds(4000.0); } // NFD only accepts TlvWireFormat packets. commandInterest->getName().append (controlParameters.wireEncode(*TlvWireFormat::get())); makeCommandInterest (*commandInterest, commandKeyChain, commandCertificateName, *TlvWireFormat::get()); if (registeredPrefixId != 0) { uint64_t interestFilterId = 0; if (onInterest) { // registerPrefix was called with the "combined" form that includes the // callback, so add an InterestFilterEntry. interestFilterId = getNextEntryId(); setInterestFilter (interestFilterId, ptr_lib::make_shared<const InterestFilter>(*prefix), onInterest, face); } registeredPrefixTable_.push_back (ptr_lib::shared_ptr<RegisteredPrefix>(new RegisteredPrefix (registeredPrefixId, prefix, interestFilterId))); } // Send the registration interest. RegisterResponse response (ptr_lib::shared_ptr<RegisterResponse::Info>(new RegisterResponse::Info (this, prefix, onInterest, onRegisterFailed, flags, wireFormat, face))); // It is OK for func_lib::function make a copy of the function object because // the Info is in a ptr_lib::shared_ptr. expressInterest (getNextEntryId(), commandInterest, response, response, wireFormat, face); }