NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
access-strategy.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_FW_ACCESS_STRATEGY_HPP
27 #define NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
28 
29 #include "strategy.hpp"
31 
33 
34 namespace nfd {
35 namespace fw {
36 
50 class AccessStrategy : public Strategy
51 {
52 public:
53  explicit
54  AccessStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
55 
56  static const Name&
58 
59 public: // triggers
60  void
61  afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
62  const shared_ptr<pit::Entry>& pitEntry) override;
63 
64  void
65  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
66  const FaceEndpoint& ingress, const Data& data) override;
67 
68 private: // StrategyInfo
70 
73  class PitInfo : public StrategyInfo
74  {
75  public:
76  static constexpr int
77  getTypeId()
78  {
79  return 1010;
80  }
81 
82  public:
83  scheduler::ScopedEventId rtoTimer;
84  };
85 
88  class MtInfo : public StrategyInfo
89  {
90  public:
91  static constexpr int
92  getTypeId()
93  {
94  return 1011;
95  }
96 
97  explicit
98  MtInfo(shared_ptr<const RttEstimator::Options> opts)
99  : rtt(std::move(opts))
100  {
101  }
102 
103  public:
104  FaceId lastNexthop = face::INVALID_FACEID;
105  RttEstimator rtt;
106  };
107 
110  std::tuple<Name, MtInfo*>
111  findPrefixMeasurements(const pit::Entry& pitEntry);
112 
116  MtInfo*
117  addPrefixMeasurements(const Data& data);
118 
123  class FaceInfo
124  {
125  public:
126  explicit
127  FaceInfo(shared_ptr<const RttEstimator::Options> opts)
128  : rtt(std::move(opts))
129  {
130  }
131 
132  public:
133  RttEstimator rtt;
134  };
135 
136 private: // forwarding procedures
137  void
138  afterReceiveNewInterest(const FaceEndpoint& ingress, const Interest& interest,
139  const shared_ptr<pit::Entry>& pitEntry);
140 
141  void
142  afterReceiveRetxInterest(const FaceEndpoint& ingress, const Interest& interest,
143  const shared_ptr<pit::Entry>& pitEntry);
144 
148  bool
149  sendToLastNexthop(const FaceEndpoint& ingress, const Interest& interest,
150  const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
151  const fib::Entry& fibEntry);
152 
153  void
154  afterRtoTimeout(const weak_ptr<pit::Entry>& pitWeak,
155  FaceId inFaceId, EndpointId inEndpointId, FaceId firstOutFaceId);
156 
161  size_t
162  multicast(const Face& inFace, const Interest& interest,
163  const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
164  FaceId exceptFace = face::INVALID_FACEID);
165 
166  void
167  updateMeasurements(const Face& inFace, const Data& data, time::nanoseconds rtt);
168 
169 private:
170  const shared_ptr<const RttEstimator::Options> m_rttEstimatorOpts;
171  std::unordered_map<FaceId, FaceInfo> m_fit;
172  RetxSuppressionFixed m_retxSuppression;
173  signal::ScopedConnection m_removeFaceConn;
174 };
175 
176 } // namespace fw
177 } // namespace nfd
178 
179 #endif // NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
nfd::fw::AccessStrategy::getStrategyName
static const Name & getStrategyName()
Definition: access-strategy.cpp:53
nfd::fw::AccessStrategy
Access Router Strategy version 1.
Definition: access-strategy.hpp:51
ndn::util::signal::ScopedConnection
Disconnects a Connection automatically upon destruction.
Definition: scoped-connection.hpp:34
nonstd::optional_lite::std11::move
T & move(T &t)
Definition: optional.hpp:421
nfd::fw::RetxSuppressionFixed
a retransmission suppression decision algorithm that suppresses retransmissions within a fixed durati...
Definition: retx-suppression-fixed.hpp:39
rtt-estimator.hpp
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
nfd::face::INVALID_FACEID
const FaceId INVALID_FACEID
indicates an invalid FaceId
Definition: face-common.hpp:47
nfd::fw::StrategyInfo
contains arbitrary information forwarding strategy places on table entries
Definition: strategy-info.hpp:37
nfd::face::FaceId
uint64_t FaceId
Identifies a face.
Definition: face-common.hpp:44
nfd::face::Face
generalization of a network interface
Definition: face.hpp:53
nfd::pit::Entry
An Interest table entry.
Definition: pit-entry.hpp:59
nfd::FaceEndpoint
Represents a face-endpoint pair in the forwarder.
Definition: face-endpoint.hpp:37
retx-suppression-fixed.hpp
ndn::Interest
Represents an Interest packet.
Definition: interest.hpp:44
nfd::fw::AccessStrategy::afterReceiveInterest
void afterReceiveInterest(const FaceEndpoint &ingress, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
Definition: access-strategy.cpp:60
nfd::fib::Entry
represents a FIB entry
Definition: fib-entry.hpp:54
ndn::Data
Represents a Data packet.
Definition: data.hpp:36
nfd::fw::Strategy
represents a forwarding strategy
Definition: strategy.hpp:38
nfd::Forwarder
Main class of NFD's forwarding engine.
Definition: forwarder.hpp:52
ndn::util::RttEstimator
RTT/RTO estimator.
Definition: rtt-estimator.hpp:42
strategy.hpp
RttEstimator
ndn RttEstimator
Definition: ndn-rtt-estimator.cpp:38
ndn::name
Definition: name-component-types.hpp:33
nfd::face::EndpointId
uint64_t EndpointId
Identifies a remote endpoint on the link.
Definition: face-common.hpp:65
nfd::fw::AccessStrategy::beforeSatisfyInterest
void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const FaceEndpoint &ingress, const Data &data) override
trigger before PIT entry is satisfied
Definition: access-strategy.cpp:209
ndn::detail::ScopedCancelHandle< EventId >
nfd::fw::AccessStrategy::AccessStrategy
AccessStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
Definition: access-strategy.cpp:37