fw: Nack in pipelines and best-route strategy
* in PIT out-record, add last incoming Nack field
* create incoming Nack pipeline
* create outgoing Nack pipeline
* modify Interest loop pipeline to send Nack upon duplicate Nonce
* in strategy API, add after receive Nack trigger and send Nack action
* in best-route strategy, send Nack-NoRoute before rejecting pending Interest
* in best-route strategy, process incoming Nack
Other changes include:
* Pit::find
* StrategyTester saved arguments structs
* TopologyTester transmit at Transport level
refs #3156
Change-Id: I7868561c0838231083d471261200aeb280cc6e9d
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index e9616d5..adab085 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -58,10 +58,17 @@
size_t
size() const;
+ /** \brief finds a PIT entry for Interest
+ * \param interest the Interest
+ * \return an existing entry with same Name and Selectors; otherwise nullptr
+ */
+ shared_ptr<pit::Entry>
+ find(const Interest& interest) const;
+
/** \brief inserts a PIT entry for Interest
- *
- * If an entry for exact same name and selectors exists, that entry is returned.
- * \return the entry, and true for new entry, false for existing entry
+ * \param interest the Interest; must be created with make_shared
+ * \return a new or existing entry with same Name and Selectors,
+ * and true for new entry, false for existing entry
*/
std::pair<shared_ptr<pit::Entry>, bool>
insert(const Interest& interest);
@@ -135,6 +142,18 @@
};
private:
+ /** \brief finds or inserts a PIT entry for Interest
+ * \param interest the Interest; must be created with make_shared if allowInsert
+ * \param allowInsert whether inserting new entry is allowed.
+ * \return if allowInsert, a new or existing entry with same Name+Selectors,
+ * and true for new entry, false for existing entry;
+ * if not allowInsert, an existing entry with same Name+Selectors and false,
+ * or {nullptr, true} if there's no existing entry
+ */
+ std::pair<shared_ptr<pit::Entry>, bool>
+ findOrInsert(const Interest& interest, bool allowInsert);
+
+private:
NameTree& m_nameTree;
size_t m_nItems;
};
@@ -145,6 +164,18 @@
return m_nItems;
}
+inline shared_ptr<pit::Entry>
+Pit::find(const Interest& interest) const
+{
+ return const_cast<Pit*>(this)->findOrInsert(interest, false).first;
+}
+
+inline std::pair<shared_ptr<pit::Entry>, bool>
+Pit::insert(const Interest& interest)
+{
+ return this->findOrInsert(interest, true);
+}
+
inline Pit::const_iterator
Pit::end() const
{