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));
56 NDN_THROW(
ConfigFile::Error(
"Unrecognized option face_system.netdev_bound." + key));
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";
73 remote.toString() +
" is unavailable"));
77 NFD_LOG_DEBUG(
"processConfig: processed " << rules.size() <<
" rules");
80 std::map<Key, shared_ptr<Face>> oldFaces;
81 oldFaces.swap(m_faces);
91 NetdevBound::parseRule(
int index,
const ConfigSection& confRule)
const 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>());
104 catch (
const FaceUri::Error&) {
105 NDN_THROW_NESTED(
RuleParseError(index,
"invalid remote FaceUri"));
107 if (!rule.remotes.back().isCanonical()) {
108 NDN_THROW(
RuleParseError(index,
"remote FaceUri is not canonical"));
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()) {
bool hasFactoryForScheme(const std::string &scheme) const
void processConfig(OptionalConfigSection configSection, FaceSystem::ConfigContext &context)
process face_system.netdev_bound config section
boost::optional< const ConfigSection & > OptionalConfigSection
an optional config file section
NetdevBound(const ProtocolFactoryCtorParams ¶ms, const FaceSystem &faceSystem)
context for processing a config section in ProtocolFactory
boost::property_tree::ptree ConfigSection
a config file section
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Parameters to ProtocolFactory constructor.
#define NFD_LOG_INIT(name)
entry point of the face system