30 #include <ndn-cxx/security/pib/identity.hpp> 31 #include <ndn-cxx/security/signing-helpers.hpp> 41 : m_keyChain(keyChain)
43 auto interval = section.get_optional<uint64_t>(
"refresh_interval");
47 optional<ReadvertiseAction>
50 auto ribEntryName = ribRoute.
entry->getName();
57 auto prefixToAdvertise = ribEntryName;
58 ndn::security::pib::Identity signingIdentity;
61 for (
const auto& identity : m_keyChain.getPib().getIdentities()) {
62 auto prefix = identity.getName();
66 prefix = prefix.getPrefix(-1);
69 if (prefix.isPrefixOf(prefixToAdvertise)) {
71 prefixToAdvertise = prefix;
72 signingIdentity = identity;
77 return ReadvertiseAction{prefixToAdvertise, ndn::security::signingByIdentity(signingIdentity)};
87 return m_refreshInterval;
HostToGatewayReadvertisePolicy(const ndn::KeyChain &keyChain, const ConfigSection §ion)
a decision made by readvertise policy
optional< ReadvertiseAction > handleNewRoute(const RibRouteRef &ribRoute) const override
decide whether to readvertise a route, and what prefix to readvertise
boost::property_tree::ptree ConfigSection
a config file section
static const time::seconds DEFAULT_REFRESH_INTERVAL
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
const Name LOCALHOST
ndn:/localhost
static const name::Component IGNORE_COMPONENT("nrd")
time::milliseconds getRefreshInterval() const override
shared_ptr< RibEntry > entry
static const Name LOCALHOP_TOP_PREFIX