NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
pit-entry.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_TABLE_PIT_ENTRY_HPP
27 #define NFD_DAEMON_TABLE_PIT_ENTRY_HPP
28 
29 #include "pit-in-record.hpp"
30 #include "pit-out-record.hpp"
31 
32 #include <list>
33 
34 namespace nfd {
35 
36 namespace name_tree {
37 class Entry;
38 } // namespace name_tree
39 
40 namespace pit {
41 
44 typedef std::list<InRecord> InRecordCollection;
45 
48 typedef std::list<OutRecord> OutRecordCollection;
49 
58 class Entry : public StrategyInfoHost, noncopyable
59 {
60 public:
61  explicit
62  Entry(const Interest& interest);
63 
69  const Interest&
70  getInterest() const
71  {
72  return *m_interest;
73  }
74 
77  const Name&
78  getName() const
79  {
80  return m_interest->getName();
81  }
82 
87  bool
88  canMatch(const Interest& interest, size_t nEqualNameComps = 0) const;
89 
90 public: // in-record
93  const InRecordCollection&
94  getInRecords() const
95  {
96  return m_inRecords;
97  }
98 
104  bool
105  hasInRecords() const
106  {
107  return !m_inRecords.empty();
108  }
109 
110  InRecordCollection::iterator
112  {
113  return m_inRecords.begin();
114  }
115 
116  InRecordCollection::const_iterator
117  in_begin() const
118  {
119  return m_inRecords.begin();
120  }
121 
122  InRecordCollection::iterator
124  {
125  return m_inRecords.end();
126  }
127 
128  InRecordCollection::const_iterator
129  in_end() const
130  {
131  return m_inRecords.end();
132  }
133 
137  InRecordCollection::iterator
138  getInRecord(const Face& face);
139 
143  InRecordCollection::iterator
144  insertOrUpdateInRecord(Face& face, const Interest& interest);
145 
148  void
149  deleteInRecord(const Face& face);
150 
153  void
154  clearInRecords();
155 
156 public: // out-record
159  const OutRecordCollection&
161  {
162  return m_outRecords;
163  }
164 
171  bool
173  {
174  return !m_outRecords.empty();
175  }
176 
177  OutRecordCollection::iterator
179  {
180  return m_outRecords.begin();
181  }
182 
183  OutRecordCollection::const_iterator
184  out_begin() const
185  {
186  return m_outRecords.begin();
187  }
188 
189  OutRecordCollection::iterator
191  {
192  return m_outRecords.end();
193  }
194 
195  OutRecordCollection::const_iterator
196  out_end() const
197  {
198  return m_outRecords.end();
199  }
200 
204  OutRecordCollection::iterator
205  getOutRecord(const Face& face);
206 
210  OutRecordCollection::iterator
211  insertOrUpdateOutRecord(Face& face, const Interest& interest);
212 
215  void
216  deleteOutRecord(const Face& face);
217 
218 public:
224 
227  bool isSatisfied = false;
228 
232  time::milliseconds dataFreshnessPeriod = 0_ms;
233 
234 private:
235  shared_ptr<const Interest> m_interest;
236  InRecordCollection m_inRecords;
237  OutRecordCollection m_outRecords;
238 
239  name_tree::Entry* m_nameTreeEntry = nullptr;
240 
241  friend class name_tree::Entry;
242 };
243 
244 } // namespace pit
245 } // namespace nfd
246 
247 #endif // NFD_DAEMON_TABLE_PIT_ENTRY_HPP
nfd::name_tree::Entry
An entry in the name tree.
Definition: name-tree-entry.hpp:42
nfd::pit::Entry::deleteOutRecord
void deleteOutRecord(const Face &face)
delete the out-record for face if it exists
Definition: pit-entry.cpp:114
nfd::pit::OutRecordCollection
std::list< OutRecord > OutRecordCollection
An unordered collection of out-records.
Definition: pit-entry.hpp:48
nfd::pit::Entry::getOutRecord
OutRecordCollection::iterator getOutRecord(const Face &face)
get the out-record for face
Definition: pit-entry.cpp:91
nfd::pit::Entry::out_end
OutRecordCollection::iterator out_end()
Definition: pit-entry.hpp:190
nfd::pit::Entry::canMatch
bool canMatch(const Interest &interest, size_t nEqualNameComps=0) const
Definition: pit-entry.cpp:39
nfd::pit::Entry::deleteInRecord
void deleteInRecord(const Face &face)
delete the in-record for face if it exists
Definition: pit-entry.cpp:75
nfd::pit::Entry::in_begin
InRecordCollection::iterator in_begin()
Definition: pit-entry.hpp:111
nfd::pit::Entry::isSatisfied
bool isSatisfied
Indicates whether this PIT entry is satisfied.
Definition: pit-entry.hpp:227
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
nfd::pit::Entry::dataFreshnessPeriod
time::milliseconds dataFreshnessPeriod
Data freshness period.
Definition: pit-entry.hpp:232
nfd::pit::Entry::Entry
Entry(const Interest &interest)
Definition: pit-entry.cpp:33
ndn::scheduler::EventId
A handle for a scheduled event.
Definition: scheduler.hpp:59
nfd::pit::Entry::getInRecords
const InRecordCollection & getInRecords() const
Definition: pit-entry.hpp:94
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
nfd::pit::Entry::in_begin
InRecordCollection::const_iterator in_begin() const
Definition: pit-entry.hpp:117
pit-out-record.hpp
nfd::pit::Entry::hasInRecords
bool hasInRecords() const
Definition: pit-entry.hpp:105
nfd::face::Face
generalization of a network interface
Definition: face.hpp:53
nfd::pit::Entry::out_begin
OutRecordCollection::const_iterator out_begin() const
Definition: pit-entry.hpp:184
nfd::pit::InRecordCollection
std::list< InRecord > InRecordCollection
An unordered collection of in-records.
Definition: pit-entry.hpp:44
nfd::pit::Entry::out_begin
OutRecordCollection::iterator out_begin()
Definition: pit-entry.hpp:178
nfd::pit::Entry
An Interest table entry.
Definition: pit-entry.hpp:59
ndn::Interest
Represents an Interest packet.
Definition: interest.hpp:44
nfd::pit::Entry::getName
const Name & getName() const
Definition: pit-entry.hpp:78
nfd::pit::Entry::getOutRecords
const OutRecordCollection & getOutRecords() const
Definition: pit-entry.hpp:160
nfd::StrategyInfoHost
Base class for an entity onto which StrategyInfo items may be placed.
Definition: strategy-info-host.hpp:36
nfd::pit::Entry::getInRecord
InRecordCollection::iterator getInRecord(const Face &face)
get the in-record for face
Definition: pit-entry.cpp:52
nfd::pit::Entry::out_end
OutRecordCollection::const_iterator out_end() const
Definition: pit-entry.hpp:196
nfd::pit::Entry::in_end
InRecordCollection::const_iterator in_end() const
Definition: pit-entry.hpp:129
nfd::pit::Entry::insertOrUpdateOutRecord
OutRecordCollection::iterator insertOrUpdateOutRecord(Face &face, const Interest &interest)
insert or update an out-record
Definition: pit-entry.cpp:98
nfd::pit::Entry::insertOrUpdateInRecord
InRecordCollection::iterator insertOrUpdateInRecord(Face &face, const Interest &interest)
insert or update an in-record
Definition: pit-entry.cpp:59
nfd::pit::Entry::in_end
InRecordCollection::iterator in_end()
Definition: pit-entry.hpp:123
nfd::pit::Entry::clearInRecords
void clearInRecords()
delete all in-records
Definition: pit-entry.cpp:85
nfd::pit::Entry::getInterest
const Interest & getInterest() const
Definition: pit-entry.hpp:70
nfd::pit::Entry::hasOutRecords
bool hasOutRecords() const
Definition: pit-entry.hpp:172
nfd::pit::Entry::expiryTimer
scheduler::EventId expiryTimer
Expiry timer.
Definition: pit-entry.hpp:223
pit-in-record.hpp