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-2018, 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 #include "core/scheduler.hpp"
32 
33 namespace nfd {
34 
35 namespace name_tree {
36 class Entry;
37 } // namespace name_tree
38 
39 namespace pit {
40 
43 typedef std::list<InRecord> InRecordCollection;
44 
47 typedef std::list<OutRecord> OutRecordCollection;
48 
57 class Entry : public StrategyInfoHost, noncopyable
58 {
59 public:
60  explicit
61  Entry(const Interest& interest);
62 
68  const Interest&
69  getInterest() const
70  {
71  return *m_interest;
72  }
73 
76  const Name&
77  getName() const
78  {
79  return m_interest->getName();
80  }
81 
86  bool
87  canMatch(const Interest& interest, size_t nEqualNameComps = 0) const;
88 
89 public: // in-record
92  const InRecordCollection&
93  getInRecords() const
94  {
95  return m_inRecords;
96  }
97 
103  bool
104  hasInRecords() const
105  {
106  return !m_inRecords.empty();
107  }
108 
111  {
112  return m_inRecords.begin();
113  }
114 
115  InRecordCollection::const_iterator
116  in_begin() const
117  {
118  return m_inRecords.begin();
119  }
120 
123  {
124  return m_inRecords.end();
125  }
126 
127  InRecordCollection::const_iterator
128  in_end() const
129  {
130  return m_inRecords.end();
131  }
132 
137  getInRecord(const Face& face);
138 
143  insertOrUpdateInRecord(Face& face, const Interest& interest);
144 
147  void
148  deleteInRecord(const Face& face);
149 
152  void
153  clearInRecords();
154 
155 public: // out-record
158  const OutRecordCollection&
160  {
161  return m_outRecords;
162  }
163 
170  bool
172  {
173  return !m_outRecords.empty();
174  }
175 
178  {
179  return m_outRecords.begin();
180  }
181 
182  OutRecordCollection::const_iterator
183  out_begin() const
184  {
185  return m_outRecords.begin();
186  }
187 
190  {
191  return m_outRecords.end();
192  }
193 
194  OutRecordCollection::const_iterator
195  out_end() const
196  {
197  return m_outRecords.end();
198  }
199 
204  getOutRecord(const Face& face);
205 
210  insertOrUpdateOutRecord(Face& face, const Interest& interest);
211 
214  void
215  deleteOutRecord(const Face& face);
216 
217 public:
223 
227 
231  time::milliseconds dataFreshnessPeriod;
232 
233 private:
234  shared_ptr<const Interest> m_interest;
235  InRecordCollection m_inRecords;
236  OutRecordCollection m_outRecords;
237 
238  name_tree::Entry* m_nameTreeEntry;
239 
240  friend class name_tree::Entry;
241 };
242 
243 } // namespace pit
244 } // namespace nfd
245 
246 #endif // NFD_DAEMON_TABLE_PIT_ENTRY_HPP
bool isSatisfied
indicate if PIT entry is satisfied
Definition: pit-entry.hpp:226
Opaque handle for a scheduled event.
OutRecordCollection::iterator getOutRecord(const Face &face)
get the out-record for face
Definition: pit-entry.cpp:92
const InRecordCollection & getInRecords() const
Definition: pit-entry.hpp:93
bool hasInRecords() const
Definition: pit-entry.hpp:104
InRecordCollection::const_iterator in_begin() const
Definition: pit-entry.hpp:116
void clearInRecords()
delete all in-records
Definition: pit-entry.cpp:86
generalization of a network interface
Definition: face.hpp:67
OutRecordCollection::iterator out_end()
Definition: pit-entry.hpp:189
base class for an entity onto which StrategyInfo items may be placed
InRecordCollection::iterator getInRecord(const Face &face)
get the in-record for face
Definition: pit-entry.cpp:53
Represents an Interest packet.
Definition: interest.hpp:42
OutRecordCollection::iterator out_begin()
Definition: pit-entry.hpp:177
std::list< InRecord > InRecordCollection
an unordered collection of in-records
Definition: pit-entry.hpp:43
OutRecordCollection::const_iterator out_end() const
Definition: pit-entry.hpp:195
Table::const_iterator iterator
Definition: cs-internal.hpp:41
bool hasOutRecords() const
Definition: pit-entry.hpp:171
InRecordCollection::iterator in_end()
Definition: pit-entry.hpp:122
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:57
void deleteOutRecord(const Face &face)
delete the out-record for face if it exists
Definition: pit-entry.cpp:115
Entry(const Interest &interest)
Definition: pit-entry.cpp:32
Represents an absolute name.
Definition: name.hpp:42
void deleteInRecord(const Face &face)
delete the in-record for face if it exists
Definition: pit-entry.cpp:76
const Interest & getInterest() const
Definition: pit-entry.hpp:69
bool canMatch(const Interest &interest, size_t nEqualNameComps=0) const
Definition: pit-entry.cpp:41
std::list< OutRecord > OutRecordCollection
an unordered collection of out-records
Definition: pit-entry.hpp:47
InRecordCollection::iterator in_begin()
Definition: pit-entry.hpp:110
InRecordCollection::iterator insertOrUpdateInRecord(Face &face, const Interest &interest)
insert or update an in-record
Definition: pit-entry.cpp:60
const Name & getName() const
Definition: pit-entry.hpp:77
OutRecordCollection::iterator insertOrUpdateOutRecord(Face &face, const Interest &interest)
insert or update an out-record
Definition: pit-entry.cpp:99
time::milliseconds dataFreshnessPeriod
Data freshness period.
Definition: pit-entry.hpp:231
OutRecordCollection::const_iterator out_begin() const
Definition: pit-entry.hpp:183
InRecordCollection::const_iterator in_end() const
Definition: pit-entry.hpp:128
const OutRecordCollection & getOutRecords() const
Definition: pit-entry.hpp:159
an entry in the name tree
scheduler::EventId expiryTimer
expiry timer
Definition: pit-entry.hpp:222