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.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
30 #ifndef NFD_DAEMON_TABLE_CS_ENTRY_HPP
31 #define NFD_DAEMON_TABLE_CS_ENTRY_HPP
32 
33 #include "common.hpp"
34 
35 namespace nfd {
36 namespace cs {
37 
38 class Entry;
39 
42 class Entry : noncopyable
43 {
44 public:
45  Entry();
46 
50  const Name&
51  getName() const;
52 
57  const Name&
58  getFullName() const;
59 
64  bool
65  isUnsolicited() const;
66 
69  const Data&
70  getData() const;
71 
74  void
75  setData(const Data& data, bool isUnsolicited);
76 
80  const time::steady_clock::TimePoint&
81  getStaleTime() const;
82 
86  void
88 
91  bool
92  isStale() const;
93 
97  void
98  reset();
99 
100 private:
101  time::steady_clock::TimePoint m_staleAt;
102  shared_ptr<const Data> m_dataPacket;
103 
104  bool m_isUnsolicited;
105 };
106 
107 inline const Name&
109 {
110  BOOST_ASSERT(m_dataPacket != nullptr);
111  return m_dataPacket->getName();
112 }
113 
114 inline const Name&
116 {
117  BOOST_ASSERT(m_dataPacket != nullptr);
118  return m_dataPacket->getFullName();
119 }
120 
121 inline const Data&
123 {
124  BOOST_ASSERT(m_dataPacket != nullptr);
125  return *m_dataPacket;
126 }
127 
128 inline bool
130 {
131  return m_isUnsolicited;
132 }
133 
134 inline const time::steady_clock::TimePoint&
136 {
137  return m_staleAt;
138 }
139 
140 } // namespace cs
141 } // namespace nfd
142 
143 #endif // NFD_DAEMON_TABLE_CS_ENTRY_HPP
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
const Name & getName() const
returns the name of the Data packet stored in the CS entry
Definition: cs-entry.hpp:108
const Data & getData() const
returns the Data packet stored in the CS entry
Definition: cs-entry.hpp:122
const Name & getFullName() const
returns the full name (including implicit digest) of the Data packet stored in the CS entry ...
Definition: cs-entry.hpp:115
void setData(const Data &data, bool isUnsolicited)
changes the content of CS entry and recomputes digest
Definition: cs-entry.cpp:44
represents a base class for CS entry
Definition: cs-entry.hpp:42
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
const time::steady_clock::TimePoint & getStaleTime() const
returns the absolute time when Data becomes expired
Definition: cs-entry.hpp:135
void updateStaleTime()
refreshes the time when Data becomes expired according to the current absolute time.
Definition: cs-entry.cpp:53