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 "channel.hpp"
30 #include "network-predicate.hpp"
31 #include "common/config-file.hpp"
32 
33 #include <ndn-cxx/net/network-address.hpp>
34 #include <ndn-cxx/net/network-interface.hpp>
35 #include <ndn-cxx/net/network-monitor.hpp>
36 
37 namespace nfd {
38 
39 class FaceTable;
40 
41 namespace face {
42 
43 class NetdevBound;
44 class ProtocolFactory;
45 struct ProtocolFactoryCtorParams;
46 
52 class FaceSystem : noncopyable
53 {
54 public:
55  FaceSystem(FaceTable& faceTable, shared_ptr<ndn::net::NetworkMonitor> netmon);
56 
57  ~FaceSystem();
58 
61  std::set<const ProtocolFactory*>
62  listProtocolFactories() const;
63 
67  getFactoryById(const std::string& id);
68 
72  getFactoryByScheme(const std::string& scheme);
73 
74  bool
75  hasFactoryForScheme(const std::string& scheme) const;
76 
77  FaceTable&
79  {
80  return m_faceTable;
81  }
82 
85  void
86  setConfigFile(ConfigFile& configFile);
87 
91  {
92  bool wantCongestionMarking = true;
93  };
94 
97  class ConfigContext : noncopyable
98  {
99  public:
101  bool isDryRun;
102  };
103 
106  makePFCtorParams();
107 
108 private:
109  void
110  processConfig(const ConfigSection& configSection, bool isDryRun,
111  const std::string& filename);
112 
116  std::map<std::string, unique_ptr<ProtocolFactory>> m_factories;
117  unique_ptr<NetdevBound> m_netdevBound;
118 
119 private:
124  std::map<std::string, ProtocolFactory*> m_factoryByScheme;
125 
126  FaceTable& m_faceTable;
127  shared_ptr<ndn::net::NetworkMonitor> m_netmon;
128 };
129 
130 } // namespace face
131 
132 using face::FaceSystem;
133 
134 } // namespace nfd
135 
136 #endif // NFD_DAEMON_FACE_FACE_SYSTEM_HPP
FaceTable & getFaceTable()
Definition: face-system.hpp:78
FaceSystem(FaceTable &faceTable, shared_ptr< ndn::net::NetworkMonitor > netmon)
Definition: face-system.cpp:40
configuration file parsing utility
Definition: config-file.hpp:57
ProtocolFactory * getFactoryByScheme(const std::string &scheme)
Definition: face-system.cpp:80
container of all faces
Definition: face-table.hpp:37
void setConfigFile(ConfigFile &configFile)
register handler for face_system section of NFD configuration file
Definition: face-system.cpp:93
bool hasFactoryForScheme(const std::string &scheme) const
Definition: face-system.cpp:87
context for processing a config section in ProtocolFactory
Definition: face-system.hpp:97
boost::property_tree::ptree ConfigSection
a config file section
Definition: config-file.hpp:37
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
configuration options from "general" section
Definition: face-system.hpp:90
Provides support for an underlying protocol.
Parameters to ProtocolFactory constructor.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:41
entry point of the face system
Definition: face-system.hpp:52
ProtocolFactory * getFactoryById(const std::string &id)
Definition: face-system.cpp:73
std::set< const ProtocolFactory * > listProtocolFactories() const
Definition: face-system.cpp:63