Checkpoint
diff --git a/model/fw/ndn-fw-tag.h b/model/fw/ndn-fw-tag.h
new file mode 100644
index 0000000..3407a07
--- /dev/null
+++ b/model/fw/ndn-fw-tag.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+
+#ifndef NDNSIM_FW_TAG_H
+#define NDNSIM_FW_TAG_H
+
+namespace ns3 {
+namespace ndn {
+namespace fw {
+
+/**
+ * \ingroup ndn
+ * \brief Abstract class for the forwarding strategy tag, which can be added to PIT entries
+ */
+class Tag
+{
+public:
+ virtual ~Tag () { };
+};
+
+} // namespace fw
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDNSIM_FW_TAG_H
diff --git a/model/pit/ndn-pit-entry.h b/model/pit/ndn-pit-entry.h
index d08c09e..d95d338 100644
--- a/model/pit/ndn-pit-entry.h
+++ b/model/pit/ndn-pit-entry.h
@@ -37,12 +37,15 @@
#include <boost/multi_index/member.hpp>
// #include <boost/multi_index/mem_fun.hpp>
#include <set>
+#include <boost/shared_ptr.hpp>
namespace ns3 {
namespace ndn {
class Pit;
+namespace fw { class Tag; }
+
namespace pit {
/// @cond include_hidden
@@ -249,6 +252,26 @@
const out_container &
GetOutgoing () const;
+ /**
+ * @brief Add new forwarding strategy tag
+ */
+ inline void
+ AddFwTag (boost::shared_ptr< fw::Tag > tag);
+
+ /**
+ * @brief Get forwarding strategy tag (tag is not removed)
+ */
+ template<class T>
+ inline boost::shared_ptr< T >
+ GetFwTag ();
+
+ /**
+ * @brief Remove the forwarding strategy tag
+ */
+ template<class T>
+ inline void
+ RemoveFwTag ();
+
private:
friend std::ostream& operator<< (std::ostream& os, const Entry &entry);
@@ -266,10 +289,78 @@
Time m_lastRetransmission; ///< @brief Last time when number of retransmissions were increased
uint32_t m_maxRetxCount; ///< @brief Maximum allowed number of retransmissions via outgoing faces
+
+ std::list< boost::shared_ptr<fw::Tag> > m_fwTags; ///< @brief Forwarding strategy tags
};
std::ostream& operator<< (std::ostream& os, const Entry &entry);
+inline void
+Entry::AddFwTag (boost::shared_ptr< fw::Tag > tag)
+{
+ m_fwTags.push_back (tag);
+}
+
+/**
+ * @brief Get and remove forwarding strategy tag
+ */
+template<class T>
+inline boost::shared_ptr< T >
+Entry::GetFwTag ()
+{
+ for (std::list< boost::shared_ptr<fw::Tag> >::iterator item = m_fwTags.begin ();
+ item != m_fwTags.end ();
+ item ++)
+ {
+ boost::shared_ptr< T > retPtr = boost::dynamic_pointer_cast<T> (*item);
+ if (retPtr != 0)
+ {
+ return retPtr;
+ }
+ }
+
+ return 0;
+}
+
+// /**
+// * @brief Peek the forwarding strategy tag
+// */
+// template<class T>
+// inline boost::shared_ptr< const T >
+// Entry::PeekFwTag () const
+// {
+// for (std::list< boost::shared_ptr<fw::Tag> >::const_iterator item = m_fwTags.begin ();
+// item != m_fwTags.end ();
+// item ++)
+// {
+// boost::shared_ptr< const T > retPtr = boost::dynamic_pointer_cast<const T> (*item);
+// if (retPtr != 0)
+// {
+// return retPtr;
+// }
+// }
+
+// return 0;
+// }
+
+template<class T>
+inline void
+Entry::RemoveFwTag ()
+{
+ for (std::list< boost::shared_ptr<fw::Tag> >::iterator item = m_fwTags.begin ();
+ item != m_fwTags.end ();
+ item ++)
+ {
+ boost::shared_ptr< T > retPtr = boost::dynamic_pointer_cast< T > (*item);
+ if (retPtr != 0)
+ {
+ m_fwTags.erase (item);
+ return;
+ }
+ }
+}
+
+
} // namespace pit
} // namespace ndn
} // namespace ns3