28 #include <ndn-cxx/encoding/block-helpers.hpp>
29 #include <ndn-cxx/encoding/tlv.hpp>
30 #include <ndn-cxx/encoding/tlv-nfd.hpp>
42 , m_keyChain(keyChain)
43 , m_dispatcher(face, keyChain)
52 Program::enableHubData(
const FaceUri& hubFaceUri)
54 auto data = make_shared<Data>(Name(
HUB_DATA_NAME).appendVersion());
55 data->setFreshnessPeriod(1_h);
56 data->setContent(makeStringBlock(tlv::nfd::Uri, hubFaceUri.toString()));
57 m_keyChain.sign(*data);
60 [
this, data] (
const Name&,
const Interest& interest) {
61 if (interest.matchesData(*data)) {
65 [
this] (
auto&&... args) {
66 handlePrefixRegistrationFailure(std::forward<decltype(args)>(args)...);
71 Program::enableRoutablePrefixesDataset(
const std::vector<Name>& routablePrefixes)
74 mgmt::makeAcceptAllAuthorization(),
75 [=] (
const Name&,
const Interest&, mgmt::StatusDatasetContext& context) {
76 for (
const Name& routablePrefix : routablePrefixes) {
77 context.append(routablePrefix.wireEncode());
85 [
this] (
auto&&... args) {
86 handlePrefixRegistrationFailure(std::forward<decltype(args)>(args)...);
91 Program::handlePrefixRegistrationFailure(
const Name& prefix,
const std::string& reason)
93 std::cerr <<
"ERROR: cannot register prefix " << prefix
94 <<
" (" << reason <<
")" << std::endl;
Program(const Options &options, Face &face, KeyChain &keyChain)
const Name ROUTABLE_PREFIXES_DATA_PREFIX
const PartialName ROUTABLE_PREFIXES_DATA_SUFFIX
std::vector< Name > routablePrefixes