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-2018, 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 #include "core/rtt-estimator.hpp"
32 
33 namespace nfd {
34 namespace fw {
35 
47 class AccessStrategy : public Strategy
48 {
49 public:
50  explicit
51  AccessStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
52 
53  static const Name&
55 
56 public: // triggers
57  void
58  afterReceiveInterest(const Face& inFace, const Interest& interest,
59  const shared_ptr<pit::Entry>& pitEntry) override;
60 
61  void
62  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
63  const Face& inFace, const Data& data) override;
64 
65 private: // StrategyInfo
68  class PitInfo : public StrategyInfo
69  {
70  public:
71  static constexpr int
72  getTypeId()
73  {
74  return 1010;
75  }
76 
77  public:
78  scheduler::ScopedEventId rtoTimer;
79  };
80 
83  class MtInfo : public StrategyInfo
84  {
85  public:
86  static constexpr int
87  getTypeId()
88  {
89  return 1011;
90  }
91 
92  MtInfo();
93 
94  public:
95  FaceId lastNexthop;
96  RttEstimator rtt;
97  };
98 
101  std::tuple<Name, MtInfo*>
102  findPrefixMeasurements(const pit::Entry& pitEntry);
103 
107  MtInfo*
108  addPrefixMeasurements(const Data& data);
109 
112  class FaceInfo
113  {
114  public:
115  FaceInfo();
116 
117  public:
118  RttEstimator rtt;
119  };
120 
121  typedef std::unordered_map<FaceId, FaceInfo> FaceInfoTable;
122 
123  void
124  removeFaceInfo(const Face& face);
125 
126 private: // forwarding procedures
127  void
128  afterReceiveNewInterest(const Face& inFace, const Interest& interest,
129  const shared_ptr<pit::Entry>& pitEntry);
130 
131  void
132  afterReceiveRetxInterest(const Face& inFace, const Interest& interest,
133  const shared_ptr<pit::Entry>& pitEntry);
134 
138  bool
139  sendToLastNexthop(const Face& inFace, const Interest& interest,
140  const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
141  const fib::Entry& fibEntry);
142 
143  void
144  afterRtoTimeout(weak_ptr<pit::Entry> pitWeak, FaceId inFaceId, FaceId firstOutFaceId);
145 
150  int
151  multicast(const Face& inFace, const Interest& interest,
152  const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
153  FaceId exceptFace = face::INVALID_FACEID);
154 
155  void
156  updateMeasurements(const Face& inFace, const Data& data,
157  const RttEstimator::Duration& rtt);
158 
159 private:
160  FaceInfoTable m_fit;
161  RetxSuppressionFixed m_retxSuppression;
162  signal::ScopedConnection m_removeFaceInfoConn;
163 };
164 
165 } // namespace fw
166 } // namespace nfd
167 
168 #endif // NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
a retransmission suppression decision algorithm that suppresses retransmissions within a fixed durati...
time::microseconds Duration
generalization of a network interface
Definition: face.hpp:67
represents a FIB entry
Definition: fib-entry.hpp:51
main class of NFD
Definition: forwarder.hpp:54
Represents an Interest packet.
Definition: interest.hpp:44
void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:59
static const Name & getStrategyName()
Disconnects a Connection automatically upon destruction.
Represents an absolute name.
Definition: name.hpp:43
represents a forwarding strategy
Definition: strategy.hpp:37
A scoped handle of scheduled event.
Definition: scheduler.hpp:123
void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) override
trigger before PIT entry is satisfied
implements the Mean-Deviation RTT estimator
Access Router Strategy version 1.
uint64_t FaceId
identifies a face
Definition: face.hpp:39
Represents a Data packet.
Definition: data.hpp:35
AccessStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
const FaceId INVALID_FACEID
indicates an invalid FaceId
Definition: face.hpp:42
contains arbitrary information forwarding strategy places on table entries