NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
asf-probing-module.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014-2019, Regents of the University of California,
4
* Arizona Board of Regents,
5
* Colorado State University,
6
* University Pierre & Marie Curie, Sorbonne University,
7
* Washington University in St. Louis,
8
* Beijing Institute of Technology,
9
* The University of Memphis.
10
*
11
* This file is part of NFD (Named Data Networking Forwarding Daemon).
12
* See AUTHORS.md for complete list of NFD authors and contributors.
13
*
14
* NFD is free software: you can redistribute it and/or modify it under the terms
15
* of the GNU General Public License as published by the Free Software Foundation,
16
* either version 3 of the License, or (at your option) any later version.
17
*
18
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
* PURPOSE. See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License along with
23
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24
*/
25
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
37
class
ProbingModule
38
{
39
public
:
40
explicit
41
ProbingModule
(
AsfMeasurements
& measurements);
42
43
void
44
scheduleProbe
(
const
fib::Entry
& fibEntry, time::milliseconds interval);
45
46
Face
*
47
getFaceToProbe
(
const
Face
& inFace,
const
Interest
& interest,
48
const
fib::Entry
& fibEntry,
const
Face
& faceUsed);
49
50
bool
51
isProbingNeeded
(
const
fib::Entry
& fibEntry,
const
Interest
& interest);
52
53
void
54
afterForwardingProbe
(
const
fib::Entry
& fibEntry,
const
Interest
& interest);
55
56
void
57
setProbingInterval
(
size_t
probingInterval);
58
59
time::milliseconds
60
getProbingInterval
()
const
61
{
62
return
m_probingInterval;
63
}
64
65
private
:
66
// Used to associate FaceInfo with the face in a NextHop
67
using
FaceInfoFacePair = std::pair<FaceInfo*, Face*>;
68
69
struct
FaceInfoCompare
70
{
71
bool
72
operator()(
const
FaceInfoFacePair& leftPair,
const
FaceInfoFacePair& rightPair)
const
73
{
74
const
FaceInfo
& lhs = *leftPair.first;
75
const
FaceInfo
& rhs = *rightPair.first;
76
77
// Sort by RTT: if a face has timed-out, rank it behind non-timed-out faces
78
return
(!lhs.
hasTimeout
() && rhs.
hasTimeout
()) ||
79
(lhs.
hasTimeout
() == rhs.
hasTimeout
() && lhs.
getSrtt
() < rhs.
getSrtt
());
80
}
81
};
82
83
using
FaceInfoFacePairSet = std::set<FaceInfoFacePair, FaceInfoCompare>;
84
85
static
Face
*
86
chooseFace(
const
FaceInfoFacePairSet& rankedFaces);
87
88
static
double
89
getProbingProbability(uint64_t rank, uint64_t rankSum, uint64_t nFaces);
90
91
public
:
92
static
constexpr time::milliseconds
DEFAULT_PROBING_INTERVAL
= 1_min;
93
static
constexpr time::milliseconds
MIN_PROBING_INTERVAL
= 1_s;
94
95
private
:
96
time::milliseconds m_probingInterval;
97
AsfMeasurements
& m_measurements;
98
};
99
100
}
// namespace asf
101
}
// namespace fw
102
}
// namespace nfd
103
104
#endif // NFD_DAEMON_FW_ASF_PROBING_MODULE_HPP
asf-measurements.hpp
nfd::fw::asf::ProbingModule::getFaceToProbe
Face * getFaceToProbe(const Face &inFace, const Interest &interest, const fib::Entry &fibEntry, const Face &faceUsed)
Definition:
asf-probing-module.cpp:67
nfd::fw::asf::ProbingModule::ProbingModule
ProbingModule(AsfMeasurements &measurements)
Definition:
asf-probing-module.cpp:42
nfd::fw::asf::AsfMeasurements
Helper class to retrieve and create strategy measurements.
Definition:
asf-measurements.hpp:189
nfd::fw::asf::FaceInfo::hasTimeout
bool hasTimeout() const
Definition:
asf-measurements.hpp:76
nfd::fw::asf::ProbingModule::getProbingInterval
time::milliseconds getProbingInterval() const
Definition:
asf-probing-module.hpp:60
nfd::fw::asf::ProbingModule::DEFAULT_PROBING_INTERVAL
static constexpr time::milliseconds DEFAULT_PROBING_INTERVAL
Definition:
asf-probing-module.hpp:92
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::fw::asf::ProbingModule::MIN_PROBING_INTERVAL
static constexpr time::milliseconds MIN_PROBING_INTERVAL
Definition:
asf-probing-module.hpp:93
nfd::face::Face
generalization of a network interface
Definition:
face.hpp:53
nfd::fw::asf::ProbingModule::afterForwardingProbe
void afterForwardingProbe(const fib::Entry &fibEntry, const Interest &interest)
Definition:
asf-probing-module.cpp:121
nfd::fw::asf::FaceInfo::getSrtt
time::nanoseconds getSrtt() const
Definition:
asf-measurements.hpp:88
ndn::Interest
Represents an Interest packet.
Definition:
interest.hpp:44
nfd::fw::asf::FaceInfo
Strategy information for each face in a namespace.
Definition:
asf-measurements.hpp:41
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:54
nfd::fw::asf::ProbingModule::scheduleProbe
void scheduleProbe(const fib::Entry &fibEntry, time::milliseconds interval)
Definition:
asf-probing-module.cpp:49
nfd::fw::asf::ProbingModule
ASF Probing Module.
Definition:
asf-probing-module.hpp:38
nfd::fw::asf::ProbingModule::setProbingInterval
void setProbingInterval(size_t probingInterval)
Definition:
asf-probing-module.cpp:174
nfd::fw::asf::ProbingModule::isProbingNeeded
bool isProbingNeeded(const fib::Entry &fibEntry, const Interest &interest)
Definition:
asf-probing-module.cpp:103
ndnSIM
NFD
daemon
fw
asf-probing-module.hpp
Generated on Mon Jun 1 2020 22:32:16 for ndnSIM by
1.8.18