Changing Closure API. No need for so many pointers...
diff --git a/ccnx/ccnx-tunnel.cpp b/ccnx/ccnx-tunnel.cpp
index 0808663..6bf117f 100644
--- a/ccnx/ccnx-tunnel.cpp
+++ b/ccnx/ccnx-tunnel.cpp
@@ -1,3 +1,24 @@
+/* -*- 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>
+ */
+
 #include "ccnx-tunnel.h"
 #include "ccnx-pco.h"
 
@@ -28,12 +49,13 @@
 }
 
 int
-CcnxTunnel::sendInterest (const Name &interest, const Closure *closure, const Selectors &selectors)
+CcnxTunnel::sendInterest (const Name &interest, const Closure &closure, const Selectors &selectors)
 {
   Name tunneledInterest = queryRoutableName(interest);
-  Closure *cp = new TunnelClosure(closure, this, interest);
-  CcnxWrapper::sendInterest(tunneledInterest, cp, selectors);
-  delete cp;
+
+  CcnxWrapper::sendInterest(tunneledInterest,
+                            TunnelClosure(closure, *this, interest),
+                            selectors);
 
   return 0;
 }
@@ -118,33 +140,30 @@
   m_rit.erase(prefix);
 }
 
-TunnelClosure::TunnelClosure(const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback)
-                  : Closure(dataCallback, timeoutCallback)
-                  , m_tunnel(tunnel)
-                  , m_originalInterest(originalInterest)
+TunnelClosure::TunnelClosure(const DataCallback &dataCallback, CcnxTunnel &tunnel,
+                             const Name &originalInterest, const TimeoutCallback &timeoutCallback)
+  : Closure(dataCallback, timeoutCallback)
+  , m_tunnel(tunnel)
+  , m_originalInterest(originalInterest)
 {
 }
 
-TunnelClosure::TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const Name &originalInterest)
-                 : Closure(*closure)
-                 , m_tunnel(tunnel)
+TunnelClosure::TunnelClosure(const Closure &closure, CcnxTunnel &tunnel, const Name &originalInterest)
+  : Closure(closure)
+  , m_tunnel(tunnel)
 {
 }
 
 Closure *
 TunnelClosure::dup() const
 {
-  Closure *closure = new TunnelClosure(*m_dataCallback, m_tunnel, m_originalInterest, *m_timeoutCallback);
-  return closure;
+  return new TunnelClosure (*this);
 }
 
 void
 TunnelClosure::runDataCallback(const Name &name, const Bytes &content)
 {
-  if (m_tunnel != NULL)
-  {
-    m_tunnel->handleTunneledData(name, content, (*m_dataCallback));
-  }
+  m_tunnel.handleTunneledData(name, content, m_dataCallback);
 }
 
 Closure::TimeoutCallbackReturnValue