utils+helper: Fix to compile against the latest version of ndn-cxx

Change-Id: If922b1c95beea08e5921af5223af042cb173f434
diff --git a/.jenkins.d/01-deps.sh b/.jenkins.d/01-deps.sh
new file mode 100755
index 0000000..1a0e8c8
--- /dev/null
+++ b/.jenkins.d/01-deps.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+set -x
+set -e
+
+IS_OSX=$( python -c "print 'yes' if 'OSX' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
+IS_UBUNTU=$( python -c "print 'yes' if 'Ubuntu' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
+
+if [[ $IS_OSX == "yes" ]]; then
+    brew update
+    brew upgrade
+    brew install boost cryptopp pkg-config libxml2
+    brew link --force libxml2
+    brew cleanup
+fi
+
+if [[ $IS_UBUNTU == "yes" ]]; then
+    sudo apt-get update -q -y
+    sudo apt-get -y install build-essential
+    sudo apt-get -y install libssl-dev libsqlite3-dev libcrypto++-dev
+
+    IS_12_04=$( python -c "print 'yes' if 'Ubuntu-12.04' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
+    if [[ $IS_12_04 == "yes" ]]; then
+        sudo apt-get install -y python-software-properties
+        sudo add-apt-repository -y ppa:boost-latest/ppa
+        sudo apt-get update -q -y
+        sudo apt-get install -y libboost1.55-all-dev
+        sudo apt-get install -y python-gnomedesktop
+    else
+        sudo apt-get install -y libboost-all-dev
+    fi
+
+    sudo apt-get install -y python-dev python-pygraphviz python-kiwi
+    sudo apt-get install -y python-pygoocanvas python-gnome2
+    sudo apt-get install -y python-rsvg ipython
+fi
diff --git a/.jenkins.d/00-deps-ndn-cxx.sh b/.jenkins.d/02-deps-ndn-cxx.sh
similarity index 75%
rename from .jenkins.d/00-deps-ndn-cxx.sh
rename to .jenkins.d/02-deps-ndn-cxx.sh
index 12e3eb2..fdfafce 100755
--- a/.jenkins.d/00-deps-ndn-cxx.sh
+++ b/.jenkins.d/02-deps-ndn-cxx.sh
@@ -7,8 +7,6 @@
 if [ ! -d ndn-cxx ]; then
     git clone git://github.com/named-data/ndn-cxx
     cd ndn-cxx
-    # TEMPORARY, the following must be removed after issue if fixed
-    git checkout 81a6c5dea60cea97c60dab0d78576c0d3b4e29ed
     BUILD="yes"
 else
     cd ndn-cxx
@@ -16,8 +14,6 @@
     sudo rm -Rf latest-version
     git clone git://github.com/named-data/ndn-cxx latest-version
     cd latest-version
-    # TEMPORARY, the following must be removed after issue if fixed
-    git checkout 81a6c5dea60cea97c60dab0d78576c0d3b4e29ed
     LATEST_VERSION=`git rev-parse HEAD || echo UNKNOWN`
     cd ..
     rm -Rf latest-version
@@ -38,6 +34,11 @@
     sudo ./waf distclean -j1 --color=yes
 fi
 
-./waf configure -j1 --color=yes --without-osx-keychain
+IS_UBUNTU_12_04=$( python -c "print 'yes' if 'Ubuntu-12.04' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
+if [[ $IS_UBUNTU_12_04 == "yes" ]]; then
+    EXTRA_FLAGS=" --boost-libs=/usr/lib/x86_64-linux-gnu"
+fi
+
+./waf configure -j1 --color=yes --without-osx-keychain $EXTRA_FLAGS
 ./waf -j1 --color=yes
 sudo ./waf install -j1 --color=yes
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 9297c7e..33352ca 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -7,12 +7,16 @@
 # git submodule update
 
 # COVERAGE=$( python -c "print '--with-coverage' if 'code-coverage' in '$JOB_NAME' else ''" )
+IS_UBUNTU_12_04=$( python -c "print 'yes' if 'Ubuntu-12.04' in '$NODE_LABELS'.strip().split(' ') else 'no'" )
+if [[ $IS_UBUNTU_12_04 == "yes" ]]; then
+    EXTRA_FLAGS=" --boost-libs=/usr/lib/x86_64-linux-gnu"
+fi
 
 # Cleanup
 sudo ./waf -j1 distclean
 
 # Configure/build in debug mode
-./waf -j1 configure --enable-examples --enable-tests
+./waf -j1 configure --enable-examples --enable-tests $EXTRA_FLAGS
 ./waf -j1 build
 
 # # Cleanup
diff --git a/docs/source/getting-started.rst b/docs/source/getting-started.rst
index 0f0ee5a..a56fbe1 100644
--- a/docs/source/getting-started.rst
+++ b/docs/source/getting-started.rst
@@ -63,7 +63,7 @@
 
            sudo apt-get install python-dev python-pygraphviz python-kiwi
            sudo apt-get install python-pygoocanvas python-gnome2
-           sudo apt-get install python-gnomedesktop python-rsvg ipython
+           sudo apt-get install python-rsvg ipython
 
    * For Fedora:
 
@@ -87,6 +87,13 @@
            # you will be able to install another useful python module
            # sudo port install py27-kiwi
 
+   * For OS X with HomeBrew
+
+       .. code-block:: bash
+
+           brew install boost cryptopp pkg-config libxml2
+           brew link --force libxml2
+
 .. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
 
 Downloading ndnSIM source
@@ -107,9 +114,6 @@
     mkdir ndnSIM
     cd ndnSIM
     git clone https://github.com/named-data/ndn-cxx.git ndn-cxx
-    cd ndn-cxx
-    git checkout 81a6c5dea60cea97c60dab0d78576c0d3b4e29ed
-    cd ..
     git clone https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
     git clone https://github.com/cawka/pybindgen.git pybindgen
     git clone https://github.com/named-data/ndnSIM.git ns-3/src/ndnSIM
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index 6e45281..fd319a6 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -61,7 +61,7 @@
 KeyChain&
 StackHelper::getKeyChain()
 {
-  static ::ndn::DummyKeyChain keyChain;
+  static ::ndn::KeyChain keyChain("pib-dummy", "tpm-dummy");
   return keyChain;
 }
 
diff --git a/utils/dummy-keychain.cpp b/utils/dummy-keychain.cpp
index 84d79ee..fefc86e 100644
--- a/utils/dummy-keychain.cpp
+++ b/utils/dummy-keychain.cpp
@@ -62,6 +62,17 @@
    0x81, 0x91, 0x0b, 0x91, 0x9f, 0x3a, 0x04, 0xa2, 0x44, 0x28, 0x19, 0xa1, 0x38, 0x21, 0x4f, 0x25,
    0x59, 0x8a, 0x48, 0xc2};
 
+const std::string DummyPublicInfo::SCHEME = "pib-dummy";
+const std::string DummyTpm::SCHEME = "tpm-dummy";
+
+NDN_CXX_KEYCHAIN_REGISTER_PIB(DummyPublicInfo, "pib-dummy", "dummy");
+NDN_CXX_KEYCHAIN_REGISTER_TPM(DummyTpm, "tpm-dummy", "dummy");
+
+DummyPublicInfo::DummyPublicInfo(const std::string& locator)
+  : SecPublicInfo(locator)
+{
+}
+
 bool
 DummyPublicInfo::doesIdentityExist(const Name& identityName)
 {
@@ -226,11 +237,34 @@
 {
 }
 
+void
+DummyPublicInfo::setTpmLocator(const std::string& tpmLocator)
+{
+  m_tpmLocator = tpmLocator;
+}
+
+std::string
+DummyPublicInfo::getTpmLocator()
+{
+  return m_tpmLocator;
+}
+
+std::string
+DummyPublicInfo::getScheme()
+{
+  return DummyPublicInfo::SCHEME;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////
 
+DummyTpm::DummyTpm(const std::string& locator)
+  : SecTpm(locator)
+{
+}
+
 void
 DummyTpm::setTpmPassword(const uint8_t* password, size_t passwordLength)
 {
@@ -343,5 +377,11 @@
   return false;
 }
 
+std::string
+DummyTpm::getScheme()
+{
+  return DummyTpm::SCHEME;
+}
+
 } // namespace security
 } // namespace ndn
diff --git a/utils/dummy-keychain.hpp b/utils/dummy-keychain.hpp
index bef13e5..4a1c0fd 100644
--- a/utils/dummy-keychain.hpp
+++ b/utils/dummy-keychain.hpp
@@ -27,6 +27,8 @@
 
 class DummyPublicInfo : public SecPublicInfo {
 public:
+  DummyPublicInfo(const std::string& locator);
+
   virtual bool
   doesIdentityExist(const Name& identityName);
 
@@ -90,6 +92,12 @@
   virtual void
   deleteIdentityInfo(const Name& identity);
 
+  virtual void
+  setTpmLocator(const std::string& tpmLocator);
+
+  virtual std::string
+  getTpmLocator();
+
 protected:
   virtual void
   setDefaultIdentityInternal(const Name& identityName);
@@ -99,6 +107,15 @@
 
   virtual void
   setDefaultCertificateNameForKeyInternal(const Name& certificateName);
+
+  virtual std::string
+  getScheme();
+
+public:
+  static const std::string SCHEME;
+
+private:
+  std::string m_tpmLocator;
 };
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -106,6 +123,8 @@
 
 class DummyTpm : public SecTpm {
 public:
+  DummyTpm(const std::string& locator);
+
   virtual void
   setTpmPassword(const uint8_t* password, size_t passwordLength);
 
@@ -155,6 +174,9 @@
   virtual void
   addAppToAcl(const Name& keyName, KeyClass keyClass, const std::string& appPath, AclType acl);
 
+  virtual std::string
+  getScheme();
+
 protected:
   virtual ConstBufferPtr
   exportPrivateKeyPkcs8FromTpm(const Name& keyName);
@@ -164,20 +186,12 @@
 
   virtual bool
   importPublicKeyPkcs1IntoTpm(const Name& keyName, const uint8_t* buffer, size_t bufferSize);
-};
 
-typedef KeyChainTraits<DummyPublicInfo, DummyTpm> DummyKeyChainTraits;
+public:
+  static const std::string SCHEME;
+};
 
 } // namespace security
-
-class DummyKeyChain : public KeyChain {
-public:
-  DummyKeyChain()
-    : KeyChain(security::DummyKeyChainTraits())
-  {
-  }
-};
-
 } // namespace ndn
 
 #endif // NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP