diff --git a/tools/ndn-autoconfig/base.cpp b/tools/ndn-autoconfig/base.cpp
new file mode 100644
index 0000000..ed051e1
--- /dev/null
+++ b/tools/ndn-autoconfig/base.cpp
@@ -0,0 +1,119 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD 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
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "base.hpp"
+
+namespace ndn {
+namespace tools {
+namespace autoconfig {
+
+Base::Base(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure)
+  : m_face(face)
+  , m_keyChain(keyChain)
+  , m_controller(face, keyChain)
+  , m_nextStageOnFailure(nextStageOnFailure)
+{
+}
+
+void
+Base::connectToHub(const std::string& uri)
+{
+  util::FaceUri faceUri(uri);
+
+  faceUri.canonize(bind(&Base::onCanonizeSuccess, this, _1),
+                   bind(&Base::onCanonizeFailure, this, _1),
+                   m_face.getIoService(), time::seconds(4));
+
+}
+
+
+void
+Base::onCanonizeSuccess(const util::FaceUri& canonicalUri)
+{
+  std::cerr << "About to connect to: " << canonicalUri.toString() << std::endl;
+
+  m_controller.start<nfd::FaceCreateCommand>(nfd::ControlParameters()
+                                               .setUri(canonicalUri.toString()),
+                                             bind(&Base::onHubConnectSuccess, this, _1),
+                                             bind(&Base::onHubConnectError, this, _1, _2));
+}
+
+void
+Base::onCanonizeFailure(const std::string& reason)
+{
+  std::ostringstream os;
+  os << "FaceUri canonization failed: " << reason;
+  throw Error(os.str());
+}
+
+void
+Base::onHubConnectSuccess(const nfd::ControlParameters& resp)
+{
+  std::cerr << "Successfully created face: " << resp << std::endl;
+
+  static const Name TESTBED_PREFIX = "/ndn";
+  registerPrefix(TESTBED_PREFIX, resp.getFaceId());
+}
+
+void
+Base::onHubConnectError(uint32_t code, const std::string& error)
+{
+  std::ostringstream os;
+  os << "Failed to create face: " << error << " (code: " << code << ")";
+  throw Error(os.str());
+}
+
+void
+Base::registerPrefix(const Name& prefix, uint64_t faceId)
+{
+  // Register a prefix in RIB
+  m_controller.start<nfd::RibRegisterCommand>(nfd::ControlParameters()
+                                                .setName(prefix)
+                                                .setFaceId(faceId)
+                                                .setOrigin(nfd::ROUTE_ORIGIN_AUTOCONF)
+                                                .setCost(100)
+                                                .setExpirationPeriod(time::milliseconds::max()),
+                                              bind(&Base::onPrefixRegistrationSuccess, this, _1),
+                                              bind(&Base::onPrefixRegistrationError, this, _1, _2));
+}
+
+void
+Base::onPrefixRegistrationSuccess(const nfd::ControlParameters& commandSuccessResult)
+{
+  std::cerr << "Successful in name registration: " << commandSuccessResult << std::endl;
+}
+
+void
+Base::onPrefixRegistrationError(uint32_t code, const std::string& error)
+{
+  std::ostringstream os;
+  os << "Failed in name registration, " << error << " (code: " << code << ")";
+  throw Error(os.str());
+}
+
+
+} // namespace autoconfig
+} // namespace tools
+} // namespace ndn
