NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cs-entry.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
30 #include "cs-entry.hpp"
31 #include "core/logger.hpp"
32 
33 namespace nfd {
34 namespace cs {
35 
36 NFD_LOG_INIT("CsEntry");
37 
39  : m_isUnsolicited(false)
40 {
41 }
42 
43 void
44 Entry::setData(const Data& data, bool isUnsolicited)
45 {
46  m_isUnsolicited = isUnsolicited;
47  m_dataPacket = data.shared_from_this();
48 
50 }
51 
52 void
54 {
55  m_staleAt = time::steady_clock::now() + m_dataPacket->getFreshnessPeriod();
56 }
57 
58 bool
60 {
61  return m_staleAt < time::steady_clock::now();
62 }
63 
64 void
66 {
67  m_staleAt = time::steady_clock::TimePoint();
68  m_dataPacket.reset();
69  m_isUnsolicited = false;
70 }
71 
72 } // namespace cs
73 } // namespace nfd
void reset()
clears CS entry After reset, *this == Entry()
Definition: cs-entry.cpp:65
bool isStale() const
checks if the stored Data is stale
Definition: cs-entry.cpp:59
void setData(const Data &data, bool isUnsolicited)
changes the content of CS entry and recomputes digest
Definition: cs-entry.cpp:44
bool isUnsolicited() const
Data packet is unsolicited if this particular NDN node did not receive an Interest packet for it...
Definition: cs-entry.hpp:129
void updateStaleTime()
refreshes the time when Data becomes expired according to the current absolute time.
Definition: cs-entry.cpp:53
#define NFD_LOG_INIT(name)
Definition: logger.hpp:33