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 #include <list>
34 
35 namespace nfd {
36 
37 namespace name_tree {
38 class Entry;
39 } // namespace name_tree
40 
41 namespace pit {
42 
45 typedef std::list<InRecord> InRecordCollection;
46 
49 typedef std::list<OutRecord> OutRecordCollection;
50 
59 class Entry : public StrategyInfoHost, noncopyable
60 {
61 public:
62  explicit
63  Entry(const Interest& interest);
64 
70  const Interest&
71  getInterest() const
72  {
73  return *m_interest;
74  }
75 
78  const Name&
79  getName() const
80  {
81  return m_interest->getName();
82  }
83 
88  bool
89  canMatch(const Interest& interest, size_t nEqualNameComps = 0) const;
90 
91 public: // in-record
94  const InRecordCollection&
95  getInRecords() const
96  {
97  return m_inRecords;
98  }
99 
105  bool
106  hasInRecords() const
107  {
108  return !m_inRecords.empty();
109  }
110 
113  {
114  return m_inRecords.begin();
115  }
116 
117  InRecordCollection::const_iterator
118  in_begin() const
119  {
120  return m_inRecords.begin();
121  }
122 
125  {
126  return m_inRecords.end();
127  }
128 
129  InRecordCollection::const_iterator
130  in_end() const
131  {
132  return m_inRecords.end();
133  }
134 
139  getInRecord(const Face& face);
140 
145  insertOrUpdateInRecord(Face& face, const Interest& interest);
146 
149  void
150  deleteInRecord(const Face& face);
151 
154  void
155  clearInRecords();
156 
157 public: // out-record
160  const OutRecordCollection&
162  {
163  return m_outRecords;
164  }
165 
172  bool
174  {
175  return !m_outRecords.empty();
176  }
177 
180  {
181  return m_outRecords.begin();
182  }
183 
184  OutRecordCollection::const_iterator
185  out_begin() const
186  {
187  return m_outRecords.begin();
188  }
189 
192  {
193  return m_outRecords.end();
194  }
195 
196  OutRecordCollection::const_iterator
197  out_end() const
198  {
199  return m_outRecords.end();
200  }
201 
206  getOutRecord(const Face& face);
207 
212  insertOrUpdateOutRecord(Face& face, const Interest& interest);
213 
216  void
217  deleteOutRecord(const Face& face);
218 
219 public:
225 
229 
233  time::milliseconds dataFreshnessPeriod;
234 
235 private:
236  shared_ptr<const Interest> m_interest;
237  InRecordCollection m_inRecords;
238  OutRecordCollection m_outRecords;
239 
240  name_tree::Entry* m_nameTreeEntry;
241 
242  friend class name_tree::Entry;
243 };
244 
245 } // namespace pit
246 } // namespace nfd
247 
248 #endif // NFD_DAEMON_TABLE_PIT_ENTRY_HPP
bool isSatisfied
indicate if PIT entry is satisfied
Definition: pit-entry.hpp:228
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:95
bool hasInRecords() const
Definition: pit-entry.hpp:106
InRecordCollection::const_iterator in_begin() const
Definition: pit-entry.hpp:118
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:191
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:44
OutRecordCollection::iterator out_begin()
Definition: pit-entry.hpp:179
std::list< InRecord > InRecordCollection
an unordered collection of in-records
Definition: pit-entry.hpp:45
OutRecordCollection::const_iterator out_end() const
Definition: pit-entry.hpp:197
Table::const_iterator iterator
Definition: cs-internal.hpp:41
bool hasOutRecords() const
Definition: pit-entry.hpp:173
InRecordCollection::iterator in_end()
Definition: pit-entry.hpp:124
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:59
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:43
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:71
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:49
InRecordCollection::iterator in_begin()
Definition: pit-entry.hpp:112
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:79
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:233
OutRecordCollection::const_iterator out_begin() const
Definition: pit-entry.hpp:185
A handle of scheduled event.
Definition: scheduler.hpp:55
InRecordCollection::const_iterator in_end() const
Definition: pit-entry.hpp:130
const OutRecordCollection & getOutRecords() const
Definition: pit-entry.hpp:161
an entry in the name tree
scheduler::EventId expiryTimer
expiry timer
Definition: pit-entry.hpp:224