NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ncc-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_NCC_STRATEGY_HPP
27 #define NFD_DAEMON_FW_NCC_STRATEGY_HPP
28 
29 #include "strategy.hpp"
30 
31 namespace nfd {
32 namespace fw {
33 
36 class NccStrategy : public Strategy
37 {
38 public:
39  NccStrategy(Forwarder& forwarder, const Name& name = STRATEGY_NAME);
40 
41  virtual
42  ~NccStrategy();
43 
44  virtual void
45  afterReceiveInterest(const Face& inFace,
46  const Interest& interest,
47  shared_ptr<fib::Entry> fibEntry,
48  shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE;
49 
50  virtual void
51  beforeSatisfyInterest(shared_ptr<pit::Entry> pitEntry,
52  const Face& inFace, const Data& data) DECL_OVERRIDE;
53 
54 protected:
57  {
58  public:
59  static constexpr int
61  {
62  return 1000;
63  }
64 
66 
67  void
68  inheritFrom(const MeasurementsEntryInfo& other);
69 
70  shared_ptr<Face>
71  getBestFace();
72 
73  void
74  updateBestFace(const Face& face);
75 
76  void
78 
79  private:
80  void
81  adjustPredictDown();
82 
83  void
84  ageBestFace();
85 
86  public:
87  weak_ptr<Face> bestFace;
88  weak_ptr<Face> previousFace;
89  time::microseconds prediction;
90 
91  static const time::microseconds INITIAL_PREDICTION;
92  static const time::microseconds MIN_PREDICTION;
93  static const int ADJUST_PREDICT_DOWN_SHIFT = 7;
94  static const time::microseconds MAX_PREDICTION;
95  static const int ADJUST_PREDICT_UP_SHIFT = 3;
96  };
97 
99  class PitEntryInfo : public StrategyInfo
100  {
101  public:
102  static constexpr int
104  {
105  return 1001;
106  }
107 
108  virtual
109  ~PitEntryInfo();
110 
111  public:
117  time::microseconds maxInterval;
118  };
119 
120 protected:
121  shared_ptr<MeasurementsEntryInfo>
122  getMeasurementsEntryInfo(shared_ptr<measurements::Entry> entry);
123 
124  shared_ptr<MeasurementsEntryInfo>
125  getMeasurementsEntryInfo(shared_ptr<pit::Entry> entry);
126 
128  void
129  doPropagate(weak_ptr<pit::Entry> pitEntryWeak, weak_ptr<fib::Entry> fibEntryWeak);
130 
132  void
133  timeoutOnBestFace(weak_ptr<pit::Entry> pitEntryWeak);
134 
135 public:
136  static const Name STRATEGY_NAME;
137 
138 protected:
139  static const time::microseconds DEFER_FIRST_WITHOUT_BEST_FACE;
140  static const time::microseconds DEFER_RANGE_WITHOUT_BEST_FACE;
141  static const int UPDATE_MEASUREMENTS_N_LEVELS = 2;
142  static const time::nanoseconds MEASUREMENTS_LIFETIME;
143 };
144 
145 } // namespace fw
146 } // namespace nfd
147 
148 #endif // NFD_DAEMON_FW_NCC_STRATEGY_HPP
static const time::microseconds DEFER_FIRST_WITHOUT_BEST_FACE
a forwarding strategy similar to CCNx 0.7.2
static const Name STRATEGY_NAME
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
StrategyInfo on measurements::Entry.
static const int UPDATE_MEASUREMENTS_N_LEVELS
static const time::microseconds DEFER_RANGE_WITHOUT_BEST_FACE
time::microseconds maxInterval
maximum interval between forwarding to two nexthops except best and previous
main class of NFD
Definition: forwarder.hpp:55
represents an Interest packet
Definition: interest.hpp:45
NccStrategy(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
shared_ptr< MeasurementsEntryInfo > getMeasurementsEntryInfo(shared_ptr< measurements::Entry > entry)
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports &#39;override&#39; specifier, otherwise expands to nothing ...
Definition: common.hpp:50
static const time::microseconds MIN_PREDICTION
virtual void beforeSatisfyInterest(shared_ptr< pit::Entry > pitEntry, const Face &inFace, const Data &data) 1
trigger before PIT entry is satisfied
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
static constexpr int getTypeId()
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
void inheritFrom(const MeasurementsEntryInfo &other)
void doPropagate(weak_ptr< pit::Entry > pitEntryWeak, weak_ptr< fib::Entry > fibEntryWeak)
propagate to another upstream
void timeoutOnBestFace(weak_ptr< pit::Entry > pitEntryWeak)
best face did not reply within prediction
static const time::nanoseconds MEASUREMENTS_LIFETIME
Name abstraction to represent an absolute name.
Definition: name.hpp:46
scheduler::EventId propagateTimer
timer for propagating to another face
scheduler::EventId bestFaceTimeout
timer that expires when best face does not respond within predicted time
StrategyInfo on pit::Entry.
represents a forwarding strategy
Definition: strategy.hpp:38
static const time::microseconds INITIAL_PREDICTION
represents a Data packet
Definition: data.hpp:39
static const time::microseconds MAX_PREDICTION
contains arbitrary information forwarding strategy places on table entries