36 : m_faceSystem(faceSystem)
37 , m_addFace(params.addFace)
38 , m_netmon(params.netmon)
46 std::vector<Rule> rules;
49 for (
const auto& pair : *configSection) {
50 const std::string& key = pair.first;
53 rules.push_back(
parseRule(ruleIndex++, value));
67 for (
size_t i = 0; i < rules.size(); ++i) {
68 const Rule& rule = rules[i];
69 for (
const FaceUri& remote : rule.remotes) {
70 std::string devScheme = remote.
getScheme() +
"+dev";
71 if (!m_faceSystem.hasFactoryForScheme(devScheme)) {
73 remote.
toString() +
" is unavailable"));
77 NFD_LOG_DEBUG(
"processConfig: processed " << rules.size() <<
" rules");
80 std::map<Key, shared_ptr<Face>> oldFaces;
95 bool hasWhitelist =
false;
96 bool hasBlacklist =
false;
97 for (
const auto& pair : confRule) {
98 const std::string& key = pair.first;
100 if (key ==
"remote") {
102 rule.remotes.emplace_back(value.get_value<std::string>());
107 if (!rule.remotes.back().isCanonical()) {
111 else if (key ==
"whitelist") {
116 rule.netifPredicate.parseWhitelist(value);
123 else if (key ==
"blacklist") {
128 rule.netifPredicate.parseBlacklist(value);
140 if (rule.remotes.empty()) {
#define NDN_THROW_NESTED(e)
void processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext &context)
process face_system.netdev_bound config section
#define NFD_LOG_INIT(name)
std::string toString() const
write as a string
entry point of the face system
ndn security validator_config Rule
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
Copyright (c) 2011-2015 Regents of the University of California.
manages netdev-bound faces
std::map< Key, shared_ptr< Face > > m_faces
std::vector< Rule > m_rules
Parameters to ProtocolFactory constructor.
boost::property_tree::ptree ConfigSection
a config file section
NetdevBound(const ProtocolFactoryCtorParams ¶ms, const FaceSystem &faceSystem)
represents the underlying protocol and address used by a Face
context for processing a config section in ProtocolFactory
const std::string & getScheme() const
get scheme (protocol)
Rule parseRule(int index, const ConfigSection &confRule) const