ccnx tunnel compiles
diff --git a/include/ccnx-tunnel.h b/include/ccnx-tunnel.h
index 21cbcbb..c17569d 100644
--- a/include/ccnx-tunnel.h
+++ b/include/ccnx-tunnel.h
@@ -1,7 +1,6 @@
#ifndef CCNX_TUNNEL_H
#define CCNX_TUNNEL_H
-#include <ccnx-wrapper.h>
#include <string>
#include <boost/function.hpp>
#include <boost/variant.hpp>
@@ -9,7 +8,16 @@
#include <utility>
#include <map>
-using namespace Sync;
+#include "ccnx-wrapper.h"
+
+#define _OVERRIDE
+#ifdef __GNUC__
+#if __GNUC_MAJOR >= 4 && __GNUC_MINOR__ >= 7
+ #undef _OVERRIDE
+ #define _OVERRIDE override
+#endif // __GNUC__ version
+#endif // __GNUC__
+
using namespace std;
// Eventually, Sync::CcnxWrapper should be moved to this namespace.
@@ -20,9 +28,8 @@
class CcnxTunnel : public CcnxWrapper
{
public:
- typedef boost::variant<StringDataCallback, RawDataCallback> DataCallback;
typedef multimap<string, InterestCallback> RegisteredInterestTable;
- typedef multimap<string, InterestCallback>iterator RitIter;
+ typedef multimap<string, InterestCallback>::iterator RitIter;
typedef boost::shared_mutex Lock;
typedef boost::unique_lock<Lock> WriteLock;
typedef boost::shared_lock<Lock> ReadLock;
@@ -33,40 +40,43 @@
// name is topology-independent
virtual int
- publishRawData(const string &name, const char *buf, size_t len, int freshness);
+ publishData(const string &name, const char *buf, size_t len, int freshness) _OVERRIDE;
+
+ virtual int
+ sendInterest (const std::string &interest, const DataCallback &dataCallback, int retry = 0, const TimeoutCallback &timeoutCallback = TimeoutCallback()) _OVERRIDE;
+
// prefix is topology-independent
virtual int
- setInterestFilter(const string &prefix, const InterestCallback &interestCallback);
+ setInterestFilter(const string &prefix, const InterestCallback &interestCallback) _OVERRIDE;
// prefix is topology-independent
// this clears all entries with key equal to prefix
virtual void
- clearInterestFilter(const string &prefix);
+ clearInterestFilter(const string &prefix) _OVERRIDE;
// subclass should provide translation service from topology-independent name
// to routable name
virtual string
- queryRoutableName(string &name) = 0;
+ queryRoutableName(const string &name) = 0;
// subclass should implement the function to store ContentObject with topoloy-independent
// name to the permanent storage; default does nothing
virtual void
- storeContentObject(string &name, ContentObjectPtr co) {}
+ storeContentObject(const string &name, const Bytes &content) {}
// should be called when connect to a different network
void
refreshLocalPrefix();
static bool
- isPrefix(string &prefix, string &name);
+ isPrefix(const string &prefix, const string &name);
-protected:
void
- handleTunneledInterest(string tunneldInterest);
-
- virtual int
- sendInterest (const std::string &strInterest, void *dataPass);
+ handleTunneledInterest(const string &tunneldInterest);
+
+ void
+ handleTunneledData(const string &name, const Bytes &tunneledData, const DataCallback &originalDataCallback);
protected:
// need a way to update local prefix, perhaps using macports trick, but eventually we need something more portable
@@ -75,6 +85,22 @@
Lock m_ritLock;
};
+class TunnelClosurePass : public ClosurePass
+{
+public:
+ TunnelClosurePass(int retry, const CcnxWrapper::DataCallback &dataCallback, const CcnxWrapper::TimeoutCallback &timeoutCallback, CcnxTunnel *tunnel, const string &originalInterest);
+
+ virtual void
+ runDataCallback(const string &name, const Bytes &content) _OVERRIDE;
+
+ virtual CcnxWrapper::TimeoutCallbackReturnValue
+ runTimeoutCallback(const string &interest) _OVERRIDE;
+
+private:
+ CcnxTunnel *m_tunnel;
+ string m_originalInterest;
+};
+
};
#endif