NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
26 #ifndef NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
27 #define NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
28 
29 #include "strategy.hpp"
30 #include "rtt-estimator.hpp"
32 #include <unordered_set>
33 #include <unordered_map>
34 
35 namespace nfd {
36 namespace fw {
37 
49 class AccessStrategy : public Strategy
50 {
51 public:
52  AccessStrategy(Forwarder& forwarder, const Name& name = STRATEGY_NAME);
53 
54  virtual
56 
57 public: // triggers
58  virtual void
59  afterReceiveInterest(const Face& inFace,
60  const Interest& interest,
61  shared_ptr<fib::Entry> fibEntry,
62  shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
63 
64  virtual void
65  beforeSatisfyInterest(shared_ptr<pit::Entry> pitEntry,
66  const Face& inFace, const Data& data) DECL_OVERRIDE;
67 
68 private: // StrategyInfo
71  class PitInfo : 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 : public StrategyInfo
87  {
88  public:
89  static constexpr int
90  getTypeId()
91  {
92  return 1011;
93  }
94 
95  MtInfo();
96 
97  public:
98  FaceId lastNexthop;
99  RttEstimator rtt;
100  };
101 
104  std::tuple<Name, shared_ptr<MtInfo>>
105  findPrefixMeasurements(const pit::Entry& pitEntry);
106 
110  shared_ptr<MtInfo>
111  addPrefixMeasurements(const Data& data);
112 
115  class FaceInfo
116  {
117  public:
118  FaceInfo();
119 
120  public:
121  RttEstimator rtt;
122  };
123 
124  typedef std::unordered_map<FaceId, FaceInfo> FaceInfoTable;
125 
126  void
127  removeFaceInfo(shared_ptr<Face> face);
128 
129 private: // forwarding procedures
130  void
131  afterReceiveNewInterest(const Face& inFace,
132  const Interest& interest,
133  shared_ptr<fib::Entry> fibEntry,
134  shared_ptr<pit::Entry> pitEntry);
135 
136  void
137  afterReceiveRetxInterest(const Face& inFace,
138  const Interest& interest,
139  shared_ptr<fib::Entry> fibEntry,
140  shared_ptr<pit::Entry> pitEntry);
141 
145  bool
146  sendToLastNexthop(const Face& inFace, shared_ptr<pit::Entry> pitEntry, MtInfo& mi,
147  shared_ptr<fib::Entry> fibEntry);
148 
149  void
150  afterRtoTimeout(weak_ptr<pit::Entry> pitWeak, weak_ptr<fib::Entry> fibWeak,
151  FaceId inFace, FaceId firstOutFace);
152 
156  void
157  multicast(shared_ptr<pit::Entry> pitEntry,
158  shared_ptr<fib::Entry> fibEntry,
159  std::unordered_set<FaceId> exceptFaces = std::unordered_set<FaceId>());
160 
161  void
162  updateMeasurements(const Face& inFace, const Data& data,
163  const RttEstimator::Duration& rtt);
164 
165 public:
166  static const Name STRATEGY_NAME;
167 
168 private:
169  FaceInfoTable m_fit;
170  RetxSuppressionFixed m_retxSuppression;
171  signal::ScopedConnection m_removeFaceInfoConn;
172 };
173 
174 } // namespace fw
175 } // namespace nfd
176 
177 #endif // NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
time::microseconds Duration
a retransmission suppression decision algorithm that suppresses retransmissions within a fixed durati...
AccessStrategy(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
main class of NFD
Definition: forwarder.hpp:55
represents an Interest packet
Definition: interest.hpp:45
static const Name STRATEGY_NAME
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports &#39;override&#39; specifier, otherwise expands to nothing ...
Definition: common.hpp:50
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, shared_ptr< fib::Entry > fibEntry, shared_ptr< pit::Entry > pitEntry) 1
trigger after Interest is received
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
represents a PIT entry
Definition: pit-entry.hpp:69
disconnects a Connection automatically upon destruction
virtual void beforeSatisfyInterest(shared_ptr< pit::Entry > pitEntry, const Face &inFace, const Data &data) 1
trigger before PIT entry is satisfied
cancels an event automatically upon destruction
Definition: scheduler.hpp:57
Name abstraction to represent an absolute name.
Definition: name.hpp:46
represents a forwarding strategy
Definition: strategy.hpp:38
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:39
contains arbitrary information forwarding strategy places on table entries