Draft PitQueue implementation using virtual time concept (good thing, but most likely not be used, at least initially)
diff --git a/utils/ndn-pit-queue.h b/utils/ndn-pit-queue.h
new file mode 100644
index 0000000..e986852
--- /dev/null
+++ b/utils/ndn-pit-queue.h
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2012 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 NDN_PIT_QUEUE_H
+#define NDN_PIT_QUEUE_H
+
+#include <map>
+#include <set>
+
+#include "ns3/ptr.h"
+
+namespace ns3 {
+namespace ndn {
+
+class Face;
+namespace pit { class Entry; }
+
+class PitQueue
+{
+public:
+ bool
+ Enqueue (Ptr<Face> inFace,
+ Ptr<pit::Entry> pitEntry);
+
+ Ptr<pit::Entry>
+ Pop ();
+
+ // cleanup procedures
+ void
+ Remove (Ptr<Face> face);
+
+ void
+ Remove (Ptr<pit::Entry> entry);
+
+private:
+ void
+ DecreasePerFaceCount (Ptr<Face> inFace);
+
+ void
+ UpdateLastVirtTime (Ptr<Face> inFace);
+
+private:
+ // all maps here consider incoming face (the whole Queue structure is per outgoing face)
+
+ double m_lastProcessedVirtualTime;
+
+ typedef std::map< Ptr<Face>, uint32_t > PerInFaceMapOfNumberOfIncomingInterests;
+ PerInFaceMapOfNumberOfIncomingInterests m_numberEnqueuedInterests;
+
+ typedef std::map< Ptr<Face>, double > PerInFaceMapOfLastVirtualTimes;
+ PerInFaceMapOfLastVirtualTimes m_lastVirtualTime;
+
+ struct Entry
+ {
+ Entry (Ptr<Face> inFace, Ptr<pit::Entry> pitEntry, double virtualTime);
+
+ bool
+ operator < (const Entry &otherEntry) const;
+
+ Ptr<Face> m_inFace;
+ Ptr<pit::Entry> m_pitEntry;
+ double m_virtualTime;
+ };
+
+ typedef std::multiset< Entry > PendingInterestsQueue;
+ PendingInterestsQueue m_queue;
+};
+
+} // namespace ndn
+} // namespace ns3
+
+#endif // NDN_PIT_QUEUE_H