more refactoring. Tunnel finishes
diff --git a/include/ccnx-closure.h b/include/ccnx-closure.h
new file mode 100644
index 0000000..54306d6
--- /dev/null
+++ b/include/ccnx-closure.h
@@ -0,0 +1,41 @@
+#ifndef CCNX_CLOSURE_H
+#define CCNX_CLOSURE_H
+
+#include "ccnx-common.h"
+
+using namespace std;
+
+namespace Ccnx {
+
+class Closure
+{
+public:
+ typedef boost::function<void (const string &, const Bytes &)> DataCallback;
+
+ typedef enum
+ {
+ RESULT_OK,
+ RESULT_REEXPRESS
+ } TimeoutCallbackReturnValue;
+
+ typedef boost::function<TimeoutCallbackReturnValue (const string &)> TimeoutCallback;
+
+ Closure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback);
+ Closure(const Closure &other);
+ int getRetry() {return m_retry;}
+ void decRetry() { m_retry--;}
+ virtual ~Closure();
+ virtual void
+ runDataCallback(const string &name, const Bytes &content);
+ virtual TimeoutCallbackReturnValue
+ runTimeoutCallback(const string &interest);
+
+protected:
+ int m_retry;
+ TimeoutCallback *m_timeoutCallback;
+ DataCallback *m_dataCallback;
+};
+
+} // Ccnx
+
+#endif