Switch from NDNx to CCNx

Change-Id: Icc2e6dd95d9c4e0ba22b7efb9933c1db7194842e
diff --git a/disabled/ndnx-tunnel.h b/disabled/ndnx-tunnel.h
new file mode 100644
index 0000000..1722eb1
--- /dev/null
+++ b/disabled/ndnx-tunnel.h
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef NDNX_TUNNEL_H
+#define NDNX_TUNNEL_H
+
+#include "ndnx-wrapper.h"
+
+#define _OVERRIDE
+#ifdef __GNUC__
+#if __GNUC_MAJOR >= 4 && __GNUC_MINOR__ >= 7
+  #undef _OVERRIDE
+  #define _OVERRIDE override
+#endif // __GNUC__ version
+#endif // __GNUC__
+
+// Eventually, Sync::NdnxWrapper should be moved to this namespace.
+// It has nothing to do with Sync.
+namespace Ndnx
+{
+
+class NdnxTunnel : public NdnxWrapper
+{
+public:
+  typedef std::multimap<Name, InterestCallback> RegisteredInterestTable;
+  typedef std::multimap<Name, InterestCallback>::iterator RitIter;
+
+
+  NdnxTunnel();
+  virtual ~NdnxTunnel();
+
+  // name is topology-independent
+  virtual int
+  publishData(const Name &name, const unsigned char *buf, size_t len, int freshness) _OVERRIDE;
+
+  int
+  publishContentObject(const Name &name, const Bytes &contentObject, int freshness);
+
+  virtual int
+  sendInterest (const Name &interest, const Closure &closure, const Selectors &selectors = Selectors());
+
+
+  // prefix is topology-independent
+  virtual int
+  setInterestFilter(const Name &prefix, const InterestCallback &interestCallback) _OVERRIDE;
+
+  // prefix is topology-independent
+  // this clears all entries with key equal to prefix
+  virtual void
+  clearInterestFilter(const Name &prefix) _OVERRIDE;
+
+  // subclass should provide translation service from topology-independent name
+  // to routable name
+  virtual Name
+  queryRoutableName(const Name &name) = 0;
+
+  // subclass should implement the function to store ContentObject with topoloy-independent
+  // name to the permanent storage; default does nothing
+  virtual void
+  storeContentObject(const Name &name, const Bytes &content) {}
+
+  // should be called  when connect to a different network
+  void
+  refreshLocalPrefix();
+
+  static bool
+  isPrefix(const Name &prefix, const Name &name);
+
+  void
+  handleTunneledInterest(const Name &tunneldInterest);
+
+  void
+  handleTunneledData(const Name &name, const Bytes &tunneledData, const Closure::DataCallback &originalDataCallback);
+
+private:
+  NdnxTunnel(const NdnxTunnel &other) {}
+
+protected:
+  // need a way to update local prefix, perhaps using macports trick, but eventually we need something more portable
+  Name m_localPrefix;
+  RegisteredInterestTable m_rit;
+  Lock m_ritLock;
+};
+
+class TunnelClosure : public Closure
+{
+public:
+  TunnelClosure(const DataCallback &dataCallback, NdnxTunnel &tunnel,
+                const Name &originalInterest, const TimeoutCallback &timeoutCallback = TimeoutCallback());
+
+  TunnelClosure(const Closure &closure, NdnxTunnel &tunnel, const Name &originalInterest);
+
+  virtual void
+  runDataCallback(const Name &name, const Bytes &content) _OVERRIDE;
+
+  virtual TimeoutCallbackReturnValue
+  runTimeoutCallback(const Name &interest) _OVERRIDE;
+
+  virtual Closure *
+  dup() const;
+
+private:
+  NdnxTunnel &m_tunnel;
+  Name m_originalInterest;
+};
+
+};
+
+#endif