30 #include <ndn-cxx/security/pib/identity.hpp>
31 #include <ndn-cxx/security/signing-helpers.hpp>
40 : m_keyChain(keyChain)
42 auto interval = section.get_optional<uint64_t>(
"refresh_interval");
46 std::optional<ReadvertiseAction>
49 auto ribEntryName = ribRoute.
entry->getName();
56 auto prefixToAdvertise = ribEntryName;
57 ndn::security::pib::Identity signingIdentity;
60 for (
const auto& identity : m_keyChain.getPib().getIdentities()) {
61 auto prefix = identity.getName();
65 prefix = prefix.getPrefix(-1);
68 if (prefix.isPrefixOf(prefixToAdvertise)) {
70 prefixToAdvertise = prefix;
71 signingIdentity = identity;
78 return ReadvertiseAction{prefixToAdvertise, ndn::security::signingByIdentity(signingIdentity)};
84 return m_refreshInterval;
static const Name LOCALHOP_TOP_PREFIX
std::optional< ReadvertiseAction > handleNewRoute(const RibRouteRef &ribRoute) const override
Decide whether to readvertise a route, and what prefix to readvertise.
HostToGatewayReadvertisePolicy(const ndn::KeyChain &keyChain, const ConfigSection §ion)
time::milliseconds getRefreshInterval() const override
const name::Component IGNORE_COMPONENT
constexpr time::seconds DEFAULT_REFRESH_INTERVAL
const Name LOCALHOST
The localhost scope ndn:/localhost.
boost::property_tree::ptree ConfigSection
A configuration file section.
A decision made by readvertise policy.
shared_ptr< RibEntry > entry