add Interet class for flexibility if we need selectors in the future
diff --git a/include/ccnx-common.h b/include/ccnx-common.h
index 7394c03..0636a62 100644
--- a/include/ccnx-common.h
+++ b/include/ccnx-common.h
@@ -13,12 +13,21 @@
using namespace std;
namespace Ccnx {
typedef vector<unsigned char> Bytes;
+typedef vector<string>Comps;
+// --- Bytes operations start ---
void
readRaw(Bytes &bytes, const unsigned char *src, size_t len);
const unsigned char *
head(const Bytes &bytes);
+// --- Bytes operations end ---
+
+// --- Name operation start ---
+void
+split(const string &name, Comps &comps);
+// --- Name operation end ---
+
} // Ccnx
#endif // CCNX_COMMON_H
diff --git a/include/ccnx-interest.h b/include/ccnx-interest.h
new file mode 100644
index 0000000..fd1db18
--- /dev/null
+++ b/include/ccnx-interest.h
@@ -0,0 +1,31 @@
+#ifndef CCNX_INTEREST_H
+#define CCNX_INTEREST_H
+#include "ccnx-common.h"
+
+namespace Ccnx {
+
+// Currently, other classes use string when Interest is needed.
+// The constructor from string ensures that if we change other classes' APIs to use Interest object
+// instead of string, it is still backwards compatible
+// Using a separate Interest class instead of simple string allows us to add control fields
+// to the Interest, e.g. ChildSelector. Perhaps that's a separate Selectors class. Will do it after ChronoShare project finishes.
+
+// Since the selector is only useful when sending Interest (in callbacks, usually we only need to know the name of the Interest),
+// we currently only use Interest object in sendInterest of CcnxWrapper. In other places, Interest object is equivalent of
+// its string name.
+
+class Interest
+{
+public:
+ Interest(const string &name) : m_name(name) {}
+ virtual ~Interest() {}
+
+ string
+ name() const { return m_name; }
+
+protected:
+ string m_name;
+};
+
+} // Ccnx
+#endif
diff --git a/include/ccnx-tunnel.h b/include/ccnx-tunnel.h
index 4e1eade..61ed964 100644
--- a/include/ccnx-tunnel.h
+++ b/include/ccnx-tunnel.h
@@ -40,7 +40,7 @@
publishData(const string &name, const unsigned char *buf, size_t len, int freshness) _OVERRIDE;
virtual int
- sendInterest (const std::string &interest, Closure *closure);
+ sendInterest (const Interest &interest, Closure *closure);
// prefix is topology-independent
diff --git a/include/ccnx-wrapper.h b/include/ccnx-wrapper.h
index 6ee5749..8d24b19 100644
--- a/include/ccnx-wrapper.h
+++ b/include/ccnx-wrapper.h
@@ -14,6 +14,7 @@
#include <boost/thread/thread.hpp>
#include "ccnx-common.h"
+#include "ccnx-interest.h"
#include "ccnx-closure.h"
using namespace std;
@@ -37,7 +38,7 @@
clearInterestFilter (const string &prefix);
virtual int
- sendInterest (const string &strInterest, Closure *closure);
+ sendInterest (const Interest &interest, Closure *closure);
virtual int
publishData (const string &name, const unsigned char *buf, size_t len, int freshness);