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-2021, 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 
48 class AccessStrategy : public Strategy
49 {
50 public:
51  explicit
52  AccessStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
53 
54  static const Name&
56 
57 public: // triggers
58  void
59  afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
60  const shared_ptr<pit::Entry>& pitEntry) override;
61 
62  void
63  beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
64  const shared_ptr<pit::Entry>& pitEntry) override;
65 
66 private: // StrategyInfo
68 
71  class PitInfo final : public StrategyInfo
72  {
73  public:
74  static constexpr int
75  getTypeId()
76  {
77  return 1010;
78  }
79 
80  public:
81  scheduler::ScopedEventId rtoTimer;
82  };
83 
86  class MtInfo final : public StrategyInfo
87  {
88  public:
89  static constexpr int
90  getTypeId()
91  {
92  return 1011;
93  }
94 
95  explicit
96  MtInfo(shared_ptr<const RttEstimator::Options> opts)
97  : rtt(std::move(opts))
98  {
99  }
100 
101  public:
102  FaceId lastNexthop = face::INVALID_FACEID;
103  RttEstimator rtt;
104  };
105 
108  std::tuple<Name, MtInfo*>
109  findPrefixMeasurements(const pit::Entry& pitEntry);
110 
114  MtInfo*
115  addPrefixMeasurements(const Data& data);
116 
121  class FaceInfo
122  {
123  public:
124  explicit
125  FaceInfo(shared_ptr<const RttEstimator::Options> opts)
126  : rtt(std::move(opts))
127  {
128  }
129 
130  public:
131  RttEstimator rtt;
132  };
133 
134 private: // forwarding procedures
135  void
136  afterReceiveNewInterest(const Interest& interest, const FaceEndpoint& ingress,
137  const shared_ptr<pit::Entry>& pitEntry);
138 
139  void
140  afterReceiveRetxInterest(const Interest& interest, const FaceEndpoint& ingress,
141  const shared_ptr<pit::Entry>& pitEntry);
142 
146  bool
147  sendToLastNexthop(const Interest& interest, const FaceEndpoint& ingress,
148  const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
149  const fib::Entry& fibEntry);
150 
151  void
152  afterRtoTimeout(const weak_ptr<pit::Entry>& pitWeak,
153  FaceId inFaceId, FaceId firstOutFaceId);
154 
159  size_t
160  multicast(const Interest& interest, const Face& inFace,
161  const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
162  FaceId exceptFace = face::INVALID_FACEID);
163 
164  void
165  updateMeasurements(const Face& inFace, const Data& data, time::nanoseconds rtt);
166 
167 private:
168  const shared_ptr<const RttEstimator::Options> m_rttEstimatorOpts;
169  std::unordered_map<FaceId, FaceInfo> m_fit;
170  RetxSuppressionFixed m_retxSuppression;
171  signal::ScopedConnection m_removeFaceConn;
172 };
173 
174 } // namespace fw
175 } // namespace nfd
176 
177 #endif // NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
a retransmission suppression decision algorithm that suppresses retransmissions within a fixed durati...
RTT/RTO estimator.
Represents a face-endpoint pair in the forwarder.
represents a FIB entry
Definition: fib-entry.hpp:53
Main class of NFD&#39;s forwarding engine.
Definition: forwarder.hpp:53
Represents an Interest packet.
Definition: interest.hpp:48
ndn Face
Definition: face-impl.hpp:42
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:39
An Interest table entry.
Definition: pit-entry.hpp:58
static const Name & getStrategyName()
Disconnects a Connection automatically upon destruction.
Represents an absolute name.
Definition: name.hpp:41
Represents a forwarding strategy.
Definition: strategy.hpp:38
void afterReceiveInterest(const Interest &interest, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry) override
Trigger after an Interest is received.
void beforeSatisfyInterest(const Data &data, const FaceEndpoint &ingress, const shared_ptr< pit::Entry > &pitEntry) override
trigger before PIT entry is satisfied
Access Router strategy.
ndn RttEstimator
Represents a Data packet.
Definition: data.hpp:37
AccessStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
uint64_t FaceId
Identifies a face.
Definition: face-common.hpp:44
const FaceId INVALID_FACEID
indicates an invalid FaceId
Definition: face-common.hpp:47
boost::chrono::nanoseconds nanoseconds
Definition: time.hpp:50
Contains arbitrary information placed by the forwarding strategy on table entries.