NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
cs-entry.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
cs-entry.hpp
"
27
28
namespace
nfd
{
29
namespace
cs {
30
31
void
32
Entry::setData
(shared_ptr<const Data> data,
bool
isUnsolicited)
33
{
34
m_data = data;
35
m_isUnsolicited =
isUnsolicited
;
36
37
updateStaleTime
();
38
}
39
40
bool
41
Entry::isStale
()
const
42
{
43
BOOST_ASSERT(this->
hasData
());
44
return
m_staleTime <
time::steady_clock::now
();
45
}
46
47
void
48
Entry::updateStaleTime
()
49
{
50
BOOST_ASSERT(this->
hasData
());
51
m_staleTime =
time::steady_clock::now
() +
time::milliseconds
(m_data->getFreshnessPeriod());
52
}
53
54
bool
55
Entry::canSatisfy
(
const
Interest
& interest)
const
56
{
57
BOOST_ASSERT(this->
hasData
());
58
if
(!interest.
matchesData
(*m_data)) {
59
return
false
;
60
}
61
62
if
(interest.
getMustBeFresh
() ==
static_cast<
int
>
(
true
) && this->
isStale
()) {
63
return
false
;
64
}
65
66
return
true
;
67
}
68
69
void
70
Entry::reset
()
71
{
72
m_data.reset();
73
m_isUnsolicited =
false
;
74
m_staleTime =
time::steady_clock::TimePoint
();
75
}
76
77
}
// namespace cs
78
}
// namespace nfd
nfd::cs::Entry::reset
void reset()
clears the entry
Definition:
cs-entry.cpp:70
ndn::time::steady_clock::TimePoint
time_point TimePoint
Definition:
time.hpp:120
nfd::cs::Entry::hasData
bool hasData() const
Definition:
cs-entry.hpp:107
nfd::cs::Entry::canSatisfy
bool canSatisfy(const Interest &interest) const
determines whether Interest can be satisified by the stored Data
Definition:
cs-entry.cpp:55
ndn::time::steady_clock::now
static time_point now() noexcept
Definition:
time.cpp:80
nfd::cs::Entry::isStale
bool isStale() const
checks if the stored Data is stale now
Definition:
cs-entry.cpp:41
websocketpp::lib::asio::milliseconds
boost::posix_time::time_duration milliseconds(long duration)
Definition:
asio.hpp:117
nfd::cs::Entry::setData
void setData(shared_ptr< const Data > data, bool isUnsolicited)
replaces the stored Data
Definition:
cs-entry.cpp:32
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:42
ndn::Interest::getMustBeFresh
int getMustBeFresh() const
Definition:
interest.hpp:318
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
cs-entry.hpp
nfd::cs::Entry::isUnsolicited
bool isUnsolicited() const
Definition:
cs-entry.hpp:73
ndn::Interest::matchesData
bool matchesData(const Data &data) const
Check if Interest can be satisfied by data.
Definition:
interest.cpp:207
nfd::cs::Entry::updateStaleTime
void updateStaleTime()
refreshes stale time relative to current time
Definition:
cs-entry.cpp:48
ndnSIM
NFD
daemon
table
cs-entry.cpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11