table: Mock implementation of FIB
refs #1127
Change-Id: Ie0bc1fc2ddcc61dd1f1cf10fb1935edde4aff6c5
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
new file mode 100644
index 0000000..0c88eaa
--- /dev/null
+++ b/daemon/table/fib.hpp
@@ -0,0 +1,48 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_TABLE_FIB_HPP
+#define NFD_TABLE_FIB_HPP
+
+#include "fib-entry.hpp"
+namespace ndn {
+
+/** \class Fib
+ * \brief represents the FIB
+ */
+class Fib : noncopyable
+{
+public:
+ Fib();
+
+ ~Fib();
+
+ /** \brief inserts a FIB entry for prefix
+ * If an entry for exact same prefix exists, that entry is returned.
+ * \return{ the entry, and true for new entry, false for existing entry }
+ */
+ std::pair<shared_ptr<fib::Entry>, bool>
+ insert(const Name& prefix);
+
+ /// performs a longest prefix match
+ shared_ptr<fib::Entry>
+ findLongestPrefixMatch(const Name& prefix) const;
+
+ /** \brief removes the NextHop record for face in all entrites
+ * This is usually invoked when face goes away.
+ * Removing all NextHops in a FIB entry will not remove the FIB entry.
+ */
+ void
+ removeNextHopFromAllEntries(shared_ptr<Face> face);
+
+private:
+ shared_ptr<fib::Entry> m_rootEntry;
+ std::list<shared_ptr<fib::Entry> > m_table;
+};
+
+} // namespace ndn
+
+#endif // NFD_TABLE_FIB_HPP