asf-probing-module.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FW_ASF_PROBING_MODULE_HPP
27 #define NFD_DAEMON_FW_ASF_PROBING_MODULE_HPP
28 
29 #include "asf-measurements.hpp"
30 
31 namespace nfd {
32 namespace fw {
33 namespace asf {
34 
38 {
39 public:
40  explicit
41  ProbingModule(AsfMeasurements& measurements);
42 
43  void
44  scheduleProbe(const fib::Entry& fibEntry, const time::milliseconds& interval);
45 
46  Face*
47  getFaceToProbe(const Face& inFace,
48  const Interest& interest,
49  const fib::Entry& fibEntry,
50  const Face& faceUsed);
51 
52  bool
53  isProbingNeeded(const fib::Entry& fibEntry, const Interest& interest);
54 
55  void
56  afterForwardingProbe(const fib::Entry& fibEntry, const Interest& interest);
57 
58 private:
59  // Used to associate FaceInfo with the face in a NextHop
60  typedef std::pair<FaceInfo*, Face*> FaceInfoFacePair;
61  typedef std::function<bool(FaceInfoFacePair, FaceInfoFacePair)> FaceInfoPredicate;
62  typedef std::set<FaceInfoFacePair, FaceInfoPredicate> FaceInfoFacePairSet;
63 
64  Face*
65  getFaceBasedOnProbability(const FaceInfoFacePairSet& rankedFaces);
66 
67  double
68  getProbingProbability(uint64_t rank, uint64_t rankSum, uint64_t nFaces);
69 
70  double
71  getRandomNumber(double start, double end);
72 
73 public:
74  static constexpr time::seconds DEFAULT_PROBING_INTERVAL = time::seconds(60);
75 
76 private:
77  time::seconds m_probingInterval;
78  AsfMeasurements& m_measurements;
79 };
80 
81 } // namespace asf
82 } // namespace fw
83 } // namespace nfd
84 
85 #endif // NFD_DAEMON_FW_ASF_PROBING_MODULE_HPP
void scheduleProbe(const fib::Entry &fibEntry, const time::milliseconds &interval)
void afterForwardingProbe(const fib::Entry &fibEntry, const Interest &interest)
ProbingModule(AsfMeasurements &measurements)
represents a FIB entry
Definition: fib-entry.hpp:51
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
static constexpr time::seconds DEFAULT_PROBING_INTERVAL
bool isProbingNeeded(const fib::Entry &fibEntry, const Interest &interest)
Face * getFaceToProbe(const Face &inFace, const Interest &interest, const fib::Entry &fibEntry, const Face &faceUsed)
Helper class to retrieve and create strategy measurements.