43 : m_faceTable(faceTable)
44 , m_netmon(std::
move(netmon))
46 auto pfCtorParams = this->makePFCtorParams();
52 m_netdevBound = make_unique<NetdevBound>(pfCtorParams, *
this);
56 FaceSystem::makePFCtorParams()
58 auto addFace = [
this] (
auto face) { m_faceTable.
add(
std::move(face)); };
59 return {addFace, m_netmon};
64 std::set<const ProtocolFactory*>
67 std::set<const ProtocolFactory*> factories;
68 for (
const auto& p : m_factories) {
69 factories.insert(p.second.get());
77 auto found = m_factories.find(
id);
78 return found == m_factories.end() ? nullptr : found->second.get();
84 auto found = m_factoryByScheme.find(scheme);
85 return found == m_factoryByScheme.end() ? nullptr : found->second;
91 return m_factoryByScheme.count(scheme) > 0;
101 FaceSystem::processConfig(
const ConfigSection& configSection,
bool isDryRun,
const std::string&)
103 ConfigContext context;
104 context.isDryRun = isDryRun;
107 auto generalSection = configSection.get_child_optional(
CFGSEC_GENERAL);
108 if (generalSection) {
109 for (
const auto& pair : *generalSection) {
110 const std::string& key = pair.first;
111 if (key ==
"enable_congestion_marking") {
121 for (
const auto& pair : m_factories) {
122 const std::string& sectionName = pair.first;
123 ProtocolFactory* factory = pair.second.get();
125 std::set<std::string> oldProvidedSchemes = factory->getProvidedSchemes();
126 factory->processConfig(configSection.get_child_optional(sectionName), context);
129 for (
const std::string& scheme : factory->getProvidedSchemes()) {
130 m_factoryByScheme[scheme] = factory;
131 if (oldProvidedSchemes.erase(scheme) == 0) {
133 " provides " << scheme <<
" FaceUri scheme");
136 for (
const std::string& scheme : oldProvidedSchemes) {
137 m_factoryByScheme.erase(scheme);
139 " no longer provides " << scheme <<
" FaceUri scheme");
146 m_netdevBound->processConfig(netdevBoundSection, context);
149 std::set<std::string> seenSections;
150 for (
const auto& pair : configSection) {
151 const std::string& sectionName = pair.first;
154 if (!seenSections.insert(sectionName).second) {
159 m_factories.count(sectionName) > 0) {