NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
face-system.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2019, Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef NFD_DAEMON_FACE_FACE_SYSTEM_HPP
27 #define NFD_DAEMON_FACE_FACE_SYSTEM_HPP
28 
29 #include "network-predicate.hpp"
30 #include "common/config-file.hpp"
31 
35 
36 namespace nfd {
37 
38 class FaceTable;
39 
40 namespace face {
41 
42 class NetdevBound;
43 class ProtocolFactory;
44 struct ProtocolFactoryCtorParams;
45 
51 class FaceSystem : noncopyable
52 {
53 public:
54  FaceSystem(FaceTable& faceTable, shared_ptr<ndn::net::NetworkMonitor> netmon);
55 
57 
60  std::set<const ProtocolFactory*>
61  listProtocolFactories() const;
62 
66  getFactoryById(const std::string& id);
67 
71  getFactoryByScheme(const std::string& scheme);
72 
73  bool
74  hasFactoryForScheme(const std::string& scheme) const;
75 
76  FaceTable&
78  {
79  return m_faceTable;
80  }
81 
84  void
85  setConfigFile(ConfigFile& configFile);
86 
90  {
91  bool wantCongestionMarking = true;
92  };
93 
96  class ConfigContext : noncopyable
97  {
98  public:
100  bool isDryRun;
101  };
102 
105  makePFCtorParams();
106 
107 private:
108  void
109  processConfig(const ConfigSection& configSection, bool isDryRun,
110  const std::string& filename);
111 
115  std::map<std::string, unique_ptr<ProtocolFactory>> m_factories;
116  unique_ptr<NetdevBound> m_netdevBound;
117 
118 private:
123  std::map<std::string, ProtocolFactory*> m_factoryByScheme;
124 
125  FaceTable& m_faceTable;
126  shared_ptr<ndn::net::NetworkMonitor> m_netmon;
127 };
128 
129 } // namespace face
130 
131 using face::FaceSystem;
132 
133 } // namespace nfd
134 
135 #endif // NFD_DAEMON_FACE_FACE_SYSTEM_HPP
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:41
config-file.hpp
nfd::face::FaceSystem::~FaceSystem
~FaceSystem()
nfd::face::FaceSystem::hasFactoryForScheme
bool hasFactoryForScheme(const std::string &scheme) const
Definition: face-system.cpp:89
nfd::face::FaceSystem
entry point of the face system
Definition: face-system.hpp:52
nfd::face::FaceSystem::getFactoryByScheme
ProtocolFactory * getFactoryByScheme(const std::string &scheme)
Definition: face-system.cpp:82
nfd::face::FaceSystem::getFaceTable
FaceTable & getFaceTable()
Definition: face-system.hpp:77
network-predicate.hpp
nfd::face::FaceSystem::listProtocolFactories
std::set< const ProtocolFactory * > listProtocolFactories() const
Definition: face-system.cpp:65
nfd::face::NetdevBound
NetdevBound
Definition: netdev-bound.cpp:33
nfd::face::ProtocolFactory
Provides support for an underlying protocol.
Definition: protocol-factory.hpp:60
nfd::face::FaceSystem
FaceSystem
Definition: face-system.cpp:35
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
network-address.hpp
nfd::ConfigFile
configuration file parsing utility
Definition: config-file.hpp:58
nfd::face::FaceSystem::ConfigContext::generalConfig
GeneralConfig generalConfig
Definition: face-system.hpp:99
nfd::FaceTable
container of all faces
Definition: face-table.hpp:39
nfd::face::FaceSystem::FaceSystem
FaceSystem(FaceTable &faceTable, shared_ptr< ndn::net::NetworkMonitor > netmon)
Definition: face-system.cpp:42
nfd::face::FaceSystem::setConfigFile
void setConfigFile(ConfigFile &configFile)
register handler for face_system section of NFD configuration file
Definition: face-system.cpp:95
nfd::face::FaceSystem::getFactoryById
ProtocolFactory * getFactoryById(const std::string &id)
Definition: face-system.cpp:75
nfd::face::ProtocolFactoryCtorParams
Parameters to ProtocolFactory constructor.
Definition: protocol-factory.hpp:47
nfd::ConfigSection
boost::property_tree::ptree ConfigSection
a config file section
Definition: ndn-l3-protocol.hpp:39
nfd::FaceTable
FaceTable
Definition: face-table.cpp:37
nfd::face::FaceSystem::GeneralConfig
configuration options from "general" section
Definition: face-system.hpp:90
nfd::face::FaceSystem::ConfigContext::isDryRun
bool isDryRun
Definition: face-system.hpp:100
nfd::face::FaceSystem::GeneralConfig::wantCongestionMarking
bool wantCongestionMarking
Definition: face-system.hpp:91
network-interface.hpp
network-monitor.hpp
nfd::face::FaceSystem::ConfigContext
context for processing a config section in ProtocolFactory
Definition: face-system.hpp:97