cs: Implementing fake CS

refs #1129

Change-Id: I1aa2e9dcea5a8f298b254f13ad651ced22118471
diff --git a/daemon/table/cs-entry.hpp b/daemon/table/cs-entry.hpp
new file mode 100644
index 0000000..adb2b8c
--- /dev/null
+++ b/daemon/table/cs-entry.hpp
@@ -0,0 +1,23 @@
+/* -*- 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_CS_ENTRY_H
+#define NFD_TABLE_CS_ENTRY_H
+#include <boost/utility.hpp>
+namespace ndn {
+namespace cs {
+
+/** \class Entry
+ *  \brief represents a CS entry
+ */
+
+class Entry : boost::noncopyable
+{
+};
+
+};//namespace cs
+};//namespace ndn
+#endif//NFD_TABLE_CS_ENTRY_H
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
new file mode 100644
index 0000000..fdf5168
--- /dev/null
+++ b/daemon/table/cs.cpp
@@ -0,0 +1,33 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+// XXX This is a fake CS that does not cache anything.
+
+#include "cs.hpp"
+namespace ndn {
+
+Cs::Cs()
+{
+}
+  
+Cs::~Cs()
+{
+}
+
+bool
+Cs::insert(boost::shared_ptr<Data> data)
+{
+  return false;
+}
+  
+boost::shared_ptr<cs::Entry>
+Cs::find(const Interest& interest)
+{
+  return boost::shared_ptr<cs::Entry>();
+}
+
+
+};//namespace ndn
diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp
new file mode 100644
index 0000000..67283b6
--- /dev/null
+++ b/daemon/table/cs.hpp
@@ -0,0 +1,43 @@
+/* -*- 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_CS_H
+#define NFD_TABLE_CS_H
+#include <boost/shared_ptr.hpp>
+#include <ndn-cpp-dev/interest.hpp>
+#include <ndn-cpp-dev/data.hpp>
+#include "cs-entry.hpp"
+namespace ndn {
+
+/** \class Cs
+ *  \brief represents the ContentStore
+ */
+class Cs : boost::noncopyable
+{
+public:
+  Cs();
+  
+  ~Cs();
+  
+  /** \brief inserts a Data packet
+   *  The caller should ensure that this Data packet is admittable,
+   *  ie. not unsolicited from a untrusted source.
+   *  This does not guarantee the Data is added to the cache;
+   *  even if the Data is added, it may be removed anytime in the future.
+   *  \return{ whether the Data is added }
+   */
+  bool
+  insert(boost::shared_ptr<Data> data);
+  
+  /** \brief finds the best match Data for an Interest
+   *  \return{ the best match, if any; otherwise null }
+   */
+  boost::shared_ptr<cs::Entry>
+  find(const Interest& interest);
+};
+
+};//namespace ndn
+#endif//NFD_TABLE_CS_H
diff --git a/tests/table/cs.cpp b/tests/table/cs.cpp
new file mode 100644
index 0000000..31a7ea2
--- /dev/null
+++ b/tests/table/cs.cpp
@@ -0,0 +1,26 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "table/cs.hpp"
+#include <boost/make_shared.hpp>
+#include <boost/test/unit_test.hpp>
+namespace ndn {
+
+BOOST_AUTO_TEST_SUITE(TableCs)
+
+BOOST_AUTO_TEST_CASE(FakeInsertFind)
+{
+  Cs cs;
+  
+  boost::shared_ptr<Data> data = boost::make_shared<Data>();
+  BOOST_CHECK_EQUAL(cs.insert(data), false);
+  
+  Interest interest;
+  BOOST_CHECK_EQUAL(cs.find(interest).get(), static_cast<cs::Entry*>(0));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+};//namespace ndn
diff --git a/wscript b/wscript
index 2561467..c3b46b1 100644
--- a/wscript
+++ b/wscript
@@ -52,10 +52,16 @@
         return
 
 def build (bld):
+    bld(target = "nfd-objects",
+        features = "cxx",
+        source = bld.path.ant_glob(['daemon/**/*.cpp'], excl=['daemon/main.cpp']),
+        use = 'BOOST NDN_CPP',
+        )
+
     bld(target = "nfd",
         features = "cxx cxxprogram",
-        source = bld.path.ant_glob(['daemon/**/*.cpp']),
-        use = 'BOOST NDN_CPP',
+        source = 'daemon/main.cpp',
+        use = 'nfd-objects',
         )        
     
     # Unit tests
@@ -64,7 +70,7 @@
           target="unit-tests",
           features = "cxx cxxprogram",
           source = bld.path.ant_glob(['tests/**/*.cpp']),
-          use = 'BOOST NDN_CPP',
+          use = 'nfd-objects',
           includes = [".", "daemon"],
           install_prefix = None,
           )