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:
36  static OnTimeout
37  makeOnTimeout
38  (Face* face, const OnData& onData, const OnTimeout& onTimeout,
39  Milliseconds maxInterestLifetime = 16000.0);
40 
41 private:
49  (Face* face, const OnData& onData, const OnTimeout& onTimeout,
50  Milliseconds maxInterestLifetime)
51  : face_(face), callerOnData_(onData), callerOnTimeout_(onTimeout),
52  maxInterestLifetime_(maxInterestLifetime)
53  {}
54 
55  void
56  onTimeout(const ptr_lib::shared_ptr<const Interest>& interest);
57 
58  Face* face_;
59  OnData callerOnData_;
60  OnTimeout callerOnTimeout_;
61  Milliseconds maxInterestLifetime_;
62 };
63 
64 }
65 
66 #endif
double Milliseconds
A time interval represented as the number of milliseconds.
Definition: common.hpp:112
Copyright (C) 2013-2017 Regents of the University of California.
Definition: common.hpp:36
The Face class provides the main methods for NDN communication.
Definition: face.hpp:86
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