Loading...
Searching...
No Matches
forwarder.hpp
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2022, 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_FW_FORWARDER_HPP
27#define NFD_DAEMON_FW_FORWARDER_HPP
28
29#include "face-table.hpp"
34#include "table/fib.hpp"
35#include "table/pit.hpp"
36#include "table/cs.hpp"
41
42namespace nfd {
43
44namespace fw {
45class Strategy;
46} // namespace fw
47
54{
55public:
56 explicit
57 Forwarder(FaceTable& faceTable);
58
59#ifdef NFD_WITH_TESTS
60 virtual
61 ~Forwarder() = default;
62#endif
63
65 getCounters() const noexcept
66 {
67 return m_counters;
68 }
69
71 getUnsolicitedDataPolicy() const noexcept
72 {
73 return *m_unsolicitedDataPolicy;
74 }
75
76 void
77 setUnsolicitedDataPolicy(unique_ptr<fw::UnsolicitedDataPolicy> policy) noexcept
78 {
79 BOOST_ASSERT(policy != nullptr);
80 m_unsolicitedDataPolicy = std::move(policy);
81 }
82
84 getNameTree() noexcept
85 {
86 return m_nameTree;
87 }
88
89 Fib&
90 getFib() noexcept
91 {
92 return m_fib;
93 }
94
95 Pit&
96 getPit() noexcept
97 {
98 return m_pit;
99 }
100
101 Cs&
102 getCs() noexcept
103 {
104 return m_cs;
105 }
106
109 {
110 return m_measurements;
111 }
112
115 {
116 return m_strategyChoice;
117 }
118
121 {
122 return m_deadNonceList;
123 }
124
127 {
128 return m_networkRegionTable;
129 }
130
133 void
134 setConfigFile(ConfigFile& configFile);
135
142 onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress);
143
147 onInterestLoop(const Interest& interest, const FaceEndpoint& ingress);
148
152 onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingress,
153 const shared_ptr<pit::Entry>& pitEntry);
154
158 onContentStoreHit(const Interest& interest, const FaceEndpoint& ingress,
159 const shared_ptr<pit::Entry>& pitEntry, const Data& data);
160
165 onOutgoingInterest(const Interest& interest, Face& egress,
166 const shared_ptr<pit::Entry>& pitEntry);
167
171 onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry);
172
178 onIncomingData(const Data& data, const FaceEndpoint& ingress);
179
183 onDataUnsolicited(const Data& data, const FaceEndpoint& ingress);
184
189 onOutgoingData(const Data& data, Face& egress);
190
196 onIncomingNack(const lp::Nack& nack, const FaceEndpoint& ingress);
197
202 onOutgoingNack(const lp::NackHeader& nack, Face& egress,
203 const shared_ptr<pit::Entry>& pitEntry);
204
206 onDroppedInterest(const Interest& interest, Face& egress);
207
209 onNewNextHop(const Name& prefix, const fib::NextHop& nextHop);
210
211private:
214 void
215 setExpiryTimer(const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration);
216
221 void
222 insertDeadNonceList(pit::Entry& pitEntry, const Face* upstream);
223
224 void
225 processConfig(const ConfigSection& configSection, bool isDryRun,
226 const std::string& filename);
227
232 struct Config
233 {
236 uint8_t defaultHopLimit = 0;
237 };
238 Config m_config;
239
240private:
241 ForwarderCounters m_counters;
242
243 FaceTable& m_faceTable;
244 unique_ptr<fw::UnsolicitedDataPolicy> m_unsolicitedDataPolicy;
245
246 NameTree m_nameTree;
247 Fib m_fib;
248 Pit m_pit;
249 Cs m_cs;
250 Measurements m_measurements;
251 StrategyChoice m_strategyChoice;
252 DeadNonceList m_deadNonceList;
253 NetworkRegionTable m_networkRegionTable;
254
255 // allow Strategy (base class) to enter pipelines
256 friend ::nfd::fw::Strategy;
257};
258
259} // namespace nfd
260
261#endif // NFD_DAEMON_FW_FORWARDER_HPP
Configuration file parsing utility.
Represents the Dead Nonce List.
Represents a face-endpoint pair in the forwarder.
Container of all faces.
Counters provided by Forwarder.
Main class of NFD's forwarding engine.
Definition forwarder.hpp:54
Fib & getFib() noexcept
Definition forwarder.hpp:90
void setConfigFile(ConfigFile &configFile)
Register handler for forwarder section of NFD configuration file.
Pit & getPit() noexcept
Definition forwarder.hpp:96
Cs & getCs() noexcept
StrategyChoice & getStrategyChoice() noexcept
NameTree & getNameTree() noexcept
Definition forwarder.hpp:84
NetworkRegionTable & getNetworkRegionTable() noexcept
Measurements & getMeasurements() noexcept
const ForwarderCounters & getCounters() const noexcept
Definition forwarder.hpp:65
DeadNonceList & getDeadNonceList() noexcept
void setUnsolicitedDataPolicy(unique_ptr< fw::UnsolicitedDataPolicy > policy) noexcept
Definition forwarder.hpp:77
fw::UnsolicitedDataPolicy & getUnsolicitedDataPolicy() const noexcept
Definition forwarder.hpp:71
Stores a collection of producer region names.
Implements the Content Store.
Definition cs.hpp:45
Generalization of a network interface.
Definition face.hpp:118
Represents the Forwarding Information Base (FIB).
Definition fib.hpp:51
Represents a nexthop record in a FIB entry.
Definition fib-entry.hpp:50
Determines how to process an unsolicited Data packet.
The Measurements table.
A common index structure for FIB, PIT, StrategyChoice, and Measurements.
Definition name-tree.hpp:37
Represents an entry in the Interest table (PIT).
Contains information about an Interest toward an outgoing face.
NFD's Interest Table.
Definition pit.hpp:85
Represents the Strategy Choice table.
#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition common.hpp:41
#define NFD_VIRTUAL_WITH_TESTS
Definition common.hpp:39
-status-http-server
Definition common.hpp:71
boost::property_tree::ptree ConfigSection
A configuration file section.