All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
exponential-re-express.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_EXPONENTIAL_RE_EXPRESS_HPP
23 #define NDN_EXPONENTIAL_RE_EXPRESS_HPP
24 
25 #include "../face.hpp"
26 
27 namespace ndn {
28 
34 class ExponentialReExpress : public ptr_lib::enable_shared_from_this<ExponentialReExpress> {
35 public:
60  static OnTimeout
62  (Face* face, const OnData& onData, const OnTimeout& onTimeout,
63  Milliseconds maxInterestLifetime = 16000.0);
64 
65 private:
73  (Face* face, const OnData& onData, const OnTimeout& onTimeout,
74  Milliseconds maxInterestLifetime)
75  : face_(face), callerOnData_(onData), callerOnTimeout_(onTimeout),
76  maxInterestLifetime_(maxInterestLifetime)
77  {}
78 
79  void
80  onTimeout(const ptr_lib::shared_ptr<const Interest>& interest);
81 
82  Face* face_;
83  OnData callerOnData_;
84  OnTimeout callerOnTimeout_;
85  Milliseconds maxInterestLifetime_;
86 };
87 
88 }
89 
90 #endif
double Milliseconds
A time interval represented as the number of milliseconds.
Definition: common.hpp:114
The Face class provides the main methods for NDN communication.
Definition: face.hpp:86
static OnTimeout makeOnTimeout(Face *face, const OnData &onData, const OnTimeout &onTimeout, Milliseconds maxInterestLifetime=16000.0)
Return a function object to use in expressInterest for onTimeout which will express the interest agai...
Definition: exponential-re-express.cpp:34
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest)> OnTimeout
An OnTimeout function object is used to pass a callback to expressInterest.
Definition: face.hpp:48
func_lib::function< void(const ptr_lib::shared_ptr< const Interest > &interest, const ptr_lib::shared_ptr< Data > &data)> OnData
An OnData function object is used to pass a callback to expressInterest.
Definition: face.hpp:35
An ExponentialReExpress uses an internal onTimeout to express the interest again with double the inte...
Definition: exponential-re-express.hpp:34