jni: Add all dependencies and their compilation scripts

Compilation has been verified for all target platforms using a slightly
modified version of CrystaX NDK 10.1.0 (the issue has been resolved with
not yet release 10.2.0)

Change-Id: I99f6c270ae8732adfa402d75ba04f42b179a1a9b
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..6ce4745
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,13 @@
+[submodule "app/src/main/jni/ndn-cxx"]
+	path = app/src/main/jni/ndn-cxx
+	url = https://github.com/named-data/ndn-cxx
+[submodule "app/src/main/jni/cryptopp"]
+	path = app/src/main/jni/cryptopp
+	url = http://github.com/cawka/cryptopp
+	branch = android
+[submodule "app/src/main/jni/sqlite3"]
+	path = app/src/main/jni/sqlite3
+	url = https://github.com/cawka/sqlite3-android.git
+[submodule "app/src/main/jni/NFD"]
+	path = app/src/main/jni/NFD
+	url = https://github.com/named-data/NFD
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
new file mode 100755
index 0000000..c69e3fb
--- /dev/null
+++ b/.jenkins.d/00-deps.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+echo -en 'travis_fold:start:deps\r'
+
+sudo apt-get install -y build-essential git openjdk-7-jdk unzip p7zip-full
+
+# SDK binaries need i386 libraries
+sudo dpkg --add-architecture i386;
+sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386
+
+echo -en 'travis_fold:end:deps\r'
diff --git a/.jenkins.d/10-get-ndk.sh b/.jenkins.d/10-get-ndk.sh
new file mode 100755
index 0000000..79368f0
--- /dev/null
+++ b/.jenkins.d/10-get-ndk.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+if [ ! -f downloads/crystax-ndk-10.1.0-linux-x86_64.7z ]; then
+    mkdir downloads || true
+    cd downloads
+    wget --no-check-certificate https://www.crystax.net/download/crystax-ndk-10.1.0-linux-x86_64.7z
+    cd ..
+fi
+
+if [ ! -d crystax-ndk-10.1.0 ]; then
+  echo -en 'travis_fold:start:NDK\r'
+  7z x downloads/crystax-ndk-10.1.0-linux-x86_64.7z > /dev/null
+  find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
+  echo -en 'travis_fold:end:NDK\r'
+fi
+
+echo ndk.dir=`pwd`/crystax-ndk-10.1.0 >> local.properties
diff --git a/.jenkins.d/10-get-sdk.sh b/.jenkins.d/10-get-sdk.sh
new file mode 100644
index 0000000..e17e09c
--- /dev/null
+++ b/.jenkins.d/10-get-sdk.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+SDK_TOOLS_VERSION=24.0.2
+BUILD_TOOLS_VERSION=21.1.2
+COMPILE_SDK_VERSION=21
+
+export ANDROID_HOME=`pwd`/android-sdk-linux
+export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+export PATH=$PATH:`pwd`/gradle-2.2.1/bin
+
+if [ ! -d android-sdk-linux ]; then
+    wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
+    tar zxf android-sdk_r24.0.2-linux.tgz
+    rm android-sdk_r24.0.2-linux.tgz
+
+    echo "y" | android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-support,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
+    echo "y" | android update sdk --filter "android-19" --no-ui --all --force
+fi
+
+wget -q https://services.gradle.org/distributions/gradle-2.2.1-bin.zip
+unzip gradle-2.2.1-bin.zip
+rm gradle-2.2.1-bin.zip
+
+echo sdk.dir=`pwd`/android-sdk-linux >> local.properties
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..315e0b8
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,33 @@
+language: android
+android:
+  components:
+    - platform-tools
+    - build-tools-21.1.2
+    - android-19
+    - android-21
+    - extra-android-support
+    - extra-android-m2repository
+    - extra-google-m2repository
+    # - tools
+    # - extra
+    # - extra-google-google_play_services
+    # - addon-google_apis-google-19
+    # - sys-img-armeabi-v7a-android-19
+jdk:
+  - openjdk7
+notifications:
+  email:
+    on_success: always
+    on_failure: always
+env:
+ - NDK_BUILD_ABI=arm64-v8a
+ - NDK_BUILD_ABI=armeabi
+ - NDK_BUILD_ABI=armeabi-v7a
+ - NDK_BUILD_ABI=mips
+ - NDK_BUILD_ABI=x86
+ - NDK_BUILD_ABI=x86_64
+before_install:
+  - travis_retry sudo apt-get install -y build-essential unzip wget p7zip-full
+  - travis_retry .jenkins.d/10-get-ndk.sh
+script:
+  - GRADLE_OPTS="-Xmx768m -Xms256m -Xss1m" NDK_BUILD_PARALLEL=1 gradle assembleRelease
diff --git a/.vagrant/Vagrantfile b/.vagrant/Vagrantfile
new file mode 100644
index 0000000..7115d2b
--- /dev/null
+++ b/.vagrant/Vagrantfile
@@ -0,0 +1,53 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+VAGRANTFILE_API_VERSION = "2"
+
+$script = <<SCRIPT
+sudo apt-get install -y build-essential git openjdk-7-jdk unzip
+
+# SDK binaries need i386 libraries
+sudo dpkg --add-architecture i386;
+sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386
+
+wget -q https://www.crystax.net/download/crystax-ndk-10.1.0-linux-x86_64.tar.bz2
+tar jxf crystax-ndk-10.1.0-linux-x86_64.tar.bz2
+rm crystax-ndk-10.1.0-linux-x86_64.tar.bz2
+find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \\;
+
+wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
+tar zxf android-sdk_r24.0.2-linux.tgz
+rm android-sdk_r24.0.2-linux.tgz
+
+SDK_TOOLS_VERSION=24.0.2
+BUILD_TOOLS_VERSION=21.1.2
+COMPILE_SDK_VERSION=21
+
+export ANDROID_HOME=`pwd`/android-sdk-linux
+export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+
+echo "y" | android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-support,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
+echo "y" | android update sdk --filter "android-19" --no-ui --all --force
+
+wget -q https://services.gradle.org/distributions/gradle-2.2.1-bin.zip
+unzip gradle-2.2.1-bin.zip
+rm gradle-2.2.1-bin.zip
+export PATH=$PATH:`pwd`/gradle-2.2.1/bin
+
+echo sdk.dir=`pwd`/android-sdk-linux > local.properties
+echo ndk.dir=`pwd`/crystax-ndk-10.1.0 >> local.properties
+SCRIPT
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  config.vm.box = "ubuntu/trusty64"
+
+  config.vm.provision "shell", privileged: false, inline: $script
+
+  config.vm.provider "virtualbox" do |vb|
+    # Don't boot with headless mode
+    vb.gui = false
+
+    # Use VBoxManage to customize the VM. For example to change memory:
+    vb.customize ["modifyvm", :id, "--memory", "4048", "--cpus", "4"]
+  end
+end
diff --git a/README.md b/README.md
index e69de29..24e97d0 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,66 @@
+NFD on Android
+==============
+
+[![Build Status](https://travis-ci.org/named-data/NFD-android.svg?branch=master)](https://travis-ci.org/named-data/NFD-android)
+
+## Prerequisites
+
+To compile code, the following is necessary
+
+- Appropriate [Android SDK](http://developer.android.com/sdk/index.html)
+- [CrystalX Android NDK](https://www.crystax.net/en/download) version 10.1.0 or later
+
+If version 10.1.0 is used, then the following patch needs to be applied:
+
+    find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
+
+Example script for Ubuntu 14.04 to get all dependencies, download SDK and NDK:
+
+    sudo apt-get install -y build-essential git openjdk-7-jdk unzip
+    wget -q https://www.crystax.net/download/crystax-ndk-10.1.0-linux-x86_64.tar.bz2
+    tar jxf crystax-ndk-10.1.0-linux-x86_64.tar.bz2
+    find crystax-ndk-10.1.0 -name byteswap.h -exec sed -i -e 's/ swap/ bswap/g' {} \;
+
+    wget -q http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
+    tar zxf android-sdk_r24.0.2-linux.tgz
+    rm android-sdk_r24.0.2-linux.tgz
+
+    echo y |  ./android-sdk-linux/tools/android update sdk -a -u -t "android-19"
+
+    wget -q https://services.gradle.org/distributions/gradle-2.2.1-bin.zip
+    unzip gradle-2.2.1-bin.zip
+
+    SDK_TOOLS_VERSION=24.0.2
+    BUILD_TOOLS_VERSION=21.1.2
+    COMPILE_SDK_VERSION=21
+
+    (sudo dpkg --add-architecture i386; sudo apt-get update -qq; sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386)
+
+    export ANDROID_HOME=`pwd`/android-sdk-linux
+    export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+
+    echo "y" | ~/android-sdk-linux/tools/android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-support,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
+
+    echo "y" | ~/android-sdk-linux/tools/android update sdk --filter "android-19" --no-ui --all --force
+
+## Building
+
+
+    git clone --recursive http://gerrit.named-data.net/NFD-android
+    echo sdk.dir=`pwd`/android-sdk-linux > NFD-android/local.properties
+    echo ndk.dir=`pwd`/crystax-ndk-10.1.0 >> NFD-android/local.properties
+    cd NFD-android
+
+    ../gradle/gradle-2.2.1/bin/gradle assembleRelease
+
+
+## Setting up environment using Vagrant
+
+The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
+in `.vagrant/` folder.  After vagrant command-line is installed, the following will create VM
+environment and fetch all necessary dependencies:
+
+    cd .vagrant
+    vagrant up
+
+Refer to vagrant documentation for more information.
diff --git a/app/build.gradle b/app/build.gradle
index 9acf98e..df49097 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -59,7 +59,15 @@
 
     // call regular ndk-build(.cmd) script from app directory
     task ndkBuild(type: Exec) {
-        commandLine getNdkBuildCmd(), '-C', file('src/main').absolutePath
+        def ndkBuildParallel = Runtime.runtime.availableProcessors()
+        if (System.env.NDK_BUILD_PARALLEL != null) {
+            ndkBuildParallel = System.env.NDK_BUILD_PARALLEL
+        }
+        def ndkBuildAbi = "all"
+        if (System.env.NDK_BUILD_ABI != null) {
+           ndkBuildAbi = System.env.NDK_BUILD_ABI
+        }
+        commandLine getNdkBuildCmd(), '-C', file('src/main').absolutePath, '-j', ndkBuildParallel, "APP_ABI=" + ndkBuildAbi
     }
 
     tasks.withType(JavaCompile) {
@@ -74,17 +82,7 @@
 }
 
 def getNdkBuildCmd() {
-    if (System.env.ANDROID_NDK_ROOT != null)
-        return System.env.ANDROID_NDK_ROOT
-
-    Properties properties = new Properties()
-    properties.load(project.rootProject.file('local.properties').newDataInputStream())
-    String ndk_dir = properties.getProperty('ndk.dir', null)
-    if (ndk_dir == null) {
-        throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
-    }
-
-    String ndk_build = ndk_dir + "/ndk-build"
+    def ndk_build = getNdkDir() + "/ndk-build"
     if (Os.isFamily(Os.FAMILY_WINDOWS)) {
         ndk_build += ".cmd"
     }
@@ -92,6 +90,19 @@
     return ndk_build
 }
 
+def getNdkDir() {
+    if (System.env.ANDROID_NDK_ROOT != null)
+        return System.env.ANDROID_NDK_ROOT
+
+    Properties properties = new Properties()
+    properties.load(project.rootProject.file('local.properties').newDataInputStream())
+    def ndk_dir = properties.getProperty('ndk.dir', null)
+    if (ndk_dir == null) {
+        throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
+    }
+    return ndk_dir
+}
+
 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
     compile 'com.android.support:appcompat-v7:20.0.0'
diff --git a/app/src/main/java/net/named_data/nfd/wrappers/Example.java b/app/src/main/java/net/named_data/nfd/wrappers/Example.java
index 0e70c0a..62f2109 100644
--- a/app/src/main/java/net/named_data/nfd/wrappers/Example.java
+++ b/app/src/main/java/net/named_data/nfd/wrappers/Example.java
@@ -6,7 +6,7 @@
 public class Example
 {
   static {
-    System.loadLibrary("nfd-example");
+    System.loadLibrary("nfd-wrapper");
   }
 
   public native static void main();
diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk
index 67d22e0..925d790 100644
--- a/app/src/main/jni/Android.mk
+++ b/app/src/main/jni/Android.mk
@@ -1,8 +1,11 @@
 LOCAL_PATH := $(call my-dir)
+LOCAL_PATH_SAVED := $(LOCAL_PATH)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := nfd-example
+LOCAL_MODULE := nfd-wrapper
 LOCAL_SRC_FILES := android-logger-streambuf.cpp wrappers-example.cpp
-# LOCAL_SHARED_LIBRARIES :=
 LOCAL_LDLIBS := -llog
 include $(BUILD_SHARED_LIBRARY)
+
+include $(LOCAL_PATH_SAVED)/ndn-cxx.mk
+include $(LOCAL_PATH_SAVED)/nfd.mk
diff --git a/app/src/main/jni/Application.mk b/app/src/main/jni/Application.mk
index 980d621..121e000 100644
--- a/app/src/main/jni/Application.mk
+++ b/app/src/main/jni/Application.mk
@@ -1,4 +1,4 @@
-APP_ABI=all
+APP_ABI := all
 
 APP_STL := gnustl_shared
 APP_GNUSTL_FORCE_CPP_FEATURES := exceptions rtti
diff --git a/app/src/main/jni/NFD b/app/src/main/jni/NFD
new file mode 160000
index 0000000..e46279d
--- /dev/null
+++ b/app/src/main/jni/NFD
@@ -0,0 +1 @@
+Subproject commit e46279dc8382316fb933697346b66f22cad1ee5e
diff --git a/app/src/main/jni/cryptopp b/app/src/main/jni/cryptopp
new file mode 160000
index 0000000..dfa7453
--- /dev/null
+++ b/app/src/main/jni/cryptopp
@@ -0,0 +1 @@
+Subproject commit dfa7453a47f397bad10a662a4117ffed99638513
diff --git a/app/src/main/jni/ndn-cxx b/app/src/main/jni/ndn-cxx
new file mode 160000
index 0000000..cf3a667
--- /dev/null
+++ b/app/src/main/jni/ndn-cxx
@@ -0,0 +1 @@
+Subproject commit cf3a667634ef93c47c0ef3056a01c47112e49427
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx b/app/src/main/jni/ndn-cxx-android/ndn-cxx
new file mode 120000
index 0000000..cd44943
--- /dev/null
+++ b/app/src/main/jni/ndn-cxx-android/ndn-cxx
@@ -0,0 +1 @@
+../ndn-cxx/src
\ No newline at end of file
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp b/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp
new file mode 100644
index 0000000..fe8e99b
--- /dev/null
+++ b/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp
@@ -0,0 +1,14 @@
+#ifndef W_SRC_NDN_CXX_CONFIG_HPP_WAF
+#define W_SRC_NDN_CXX_CONFIG_HPP_WAF
+
+#define NDN_CXX_HAVE_IS_DEFAULT_CONSTRUCTIBLE 1
+#define NDN_CXX_HAVE_IS_MOVE_CONSTRUCTIBLE 1
+#define NDN_CXX_HAVE_IS_MOVE_ASSIGNABLE 1
+#define NDN_CXX_HAVE_CXX_FRIEND_TYPENAME 1
+#define NDN_CXX_HAVE_PTHREAD 1
+#define NDN_CXX_HAVE_RT
+#define NDN_CXX_HAVE_SQLITE3 1
+#define NDN_CXX_HAVE_CRYPTOPP_CONFIG_H 1
+#define NDN_CXX_SYSCONFDIR "./etc"
+
+#endif /* W_SRC_NDN_CXX_CONFIG_HPP_WAF */
diff --git a/app/src/main/jni/ndn-cxx.mk b/app/src/main/jni/ndn-cxx.mk
new file mode 100644
index 0000000..4ecb9be
--- /dev/null
+++ b/app/src/main/jni/ndn-cxx.mk
@@ -0,0 +1,18 @@
+LOCAL_PATH := $(call my-dir)
+LOCAL_PATH_SAVED := $(LOCAL_PATH)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := ndn-cxx
+NDN_CXX_BOOST_LIBS = system filesystem date_time iostreams regex program_options chrono random
+LOCAL_SHARED_LIBRARIES := cryptopp $(addsuffix _shared,$(addprefix boost_,$(NDN_CXX_BOOST_LIBS)))
+LOCAL_STATIC_LIBRARIES := sqlite3
+NDN_CXX_SRC_FILES := name.cpp util/dns.cpp util/time-unit-test-clock.cpp util/segment-fetcher.cpp util/config-file.cpp util/in-memory-storage.cpp util/in-memory-storage-lfu.cpp util/in-memory-storage-fifo.cpp util/ethernet.cpp util/crypto.cpp util/regex/regex-top-matcher.cpp util/signal-scoped-connection.cpp util/dummy-client-face.cpp util/scheduler.cpp util/indented-stream.cpp util/signal-connection.cpp util/in-memory-storage-persistent.cpp util/digest.cpp util/in-memory-storage-lru.cpp util/in-memory-storage-entry.cpp util/time.cpp util/random.cpp util/face-uri.cpp interest-filter.cpp signature.cpp transport/tcp-transport.cpp transport/unix-transport.cpp management/nfd-face-event-notification.cpp management/nfd-control-command.cpp management/nfd-command-options.cpp management/nfd-face-status.cpp management/nfd-control-response.cpp management/nfd-rib-entry.cpp management/nfd-controller.cpp management/nfd-forwarder-status.cpp management/nfd-channel-status.cpp management/nfd-fib-entry.cpp management/nfd-strategy-choice.cpp management/nfd-face-query-filter.cpp management/nfd-control-parameters.cpp exclude.cpp name-component.cpp face.cpp key-locator.cpp data.cpp interest.cpp selectors.cpp meta-info.cpp signature-info.cpp encoding/nfd-constants.cpp encoding/oid.cpp encoding/cryptopp/asn_ext.cpp encoding/block.cpp encoding/buffer.cpp security/sec-public-info-sqlite3.cpp security/signature-sha256-with-rsa.cpp security/public-key.cpp security/certificate-cache-ttl.cpp security/sec-rule-specific.cpp security/sec-tpm-file.cpp security/digest-sha256.cpp security/sec-public-info.cpp security/certificate.cpp security/identity-certificate.cpp security/certificate-subject-description.cpp security/certificate-extension.cpp security/sec-tpm.cpp security/validator.cpp security/sec-rule-relative.cpp security/key-params.cpp security/secured-bag.cpp security/key-chain.cpp security/signature-sha256-with-ecdsa.cpp security/validator-config.cpp security/validator-regex.cpp
+LOCAL_SRC_FILES := $(addprefix ndn-cxx/src/,$(NDN_CXX_SRC_FILES))
+LOCAL_CPPFLAGS := -I$(LOCAL_PATH)/ndn-cxx/src -I$(LOCAL_PATH)/ndn-cxx-android
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ndn-cxx-android
+include $(BUILD_SHARED_LIBRARY)
+
+include $(LOCAL_PATH_SAVED)/sqlite3/Android.mk
+include $(LOCAL_PATH_SAVED)/cryptopp/Android.mk
+
+$(call import-module,boost/1.57.0)
diff --git a/app/src/main/jni/nfd-android/config.hpp b/app/src/main/jni/nfd-android/config.hpp
new file mode 100644
index 0000000..78b3f8b
--- /dev/null
+++ b/app/src/main/jni/nfd-android/config.hpp
@@ -0,0 +1,12 @@
+#ifndef W_CONFIG_HPP_WAF
+#define W_CONFIG_HPP_WAF
+
+#define HAVE_IS_DEFAULT_CONSTRUCTIBLE 1
+#define HAVE_IS_MOVE_CONSTRUCTIBLE 1
+#define HAVE_CXX_OVERRIDE 1
+#define HAVE_LIBRT
+#define HAVE_LIBRESOLV
+/*#undef HAVE_UNIX_SOCKETS*/
+#define DEFAULT_CONFIG_FILE "./nfd.conf"
+
+#endif /* W_CONFIG_HPP_WAF */
diff --git a/app/src/main/jni/nfd-android/version.hpp b/app/src/main/jni/nfd-android/version.hpp
new file mode 100644
index 0000000..d9aa54a
--- /dev/null
+++ b/app/src/main/jni/nfd-android/version.hpp
@@ -0,0 +1,74 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  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/>.
+ */
+
+#ifndef NFD_VERSION_HPP
+#define NFD_VERSION_HPP
+
+namespace nfd {
+
+/** NFD version follows Semantic Versioning 2.0.0 specification
+ *  http://semver.org/
+ */
+
+// To change version number, modify VERSION variable in top-level wscript.
+
+/** \brief NFD version represented as an integer
+ *
+ *  MAJOR*1000000 + MINOR*1000 + PATCH
+ */
+#define NFD_VERSION 2000
+
+/** \brief NFD version represented as a string
+ *
+ *  MAJOR.MINOR.PATCH
+ */
+#define NFD_VERSION_STRING "0.2.0"
+
+/** \brief NFD version string, including git commit information, if NFD is build from
+ *         specific git commit
+ *
+ * NFD_VERSION_BUILD_STRING is obtained using the following command (`NFD-` prefix is
+ * afterwards removed):
+ *
+ *    `git describe --match 'NFD-*'`
+ *
+ * When NFD is built not from git, NFD_VERSION_BUILD_STRING equals NFD_VERSION_STRING
+ *
+ * MAJOR.MINOR.PATCH(-release-candidate-tag)(-(number-of-commits-since-tag)-COMMIT-HASH)
+ *
+ * Example, 0.1.0-rc1-1-g5c86570
+ */
+#define NFD_VERSION_BUILD_STRING "0.2.0-134-gde88b46"
+
+/// MAJOR version
+#define NFD_VERSION_MAJOR 0
+/// MINOR version
+#define NFD_VERSION_MINOR 2
+/// PATCH version
+#define NFD_VERSION_PATCH 0
+
+} // namespace nfd
+
+#endif // NFD_VERSION_HPP
diff --git a/app/src/main/jni/nfd.mk b/app/src/main/jni/nfd.mk
new file mode 100644
index 0000000..04cf7e3
--- /dev/null
+++ b/app/src/main/jni/nfd.mk
@@ -0,0 +1,34 @@
+LOCAL_PATH := $(call my-dir)
+LOCAL_PATH_SAVED := $(LOCAL_PATH)
+
+NFD_BOOST_LIBS = system filesystem chrono program_options random
+
+# core
+include $(CLEAR_VARS)
+LOCAL_MODULE := nfd-core
+LOCAL_SHARED_LIBRARIES := cryptopp ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
+NFD_CORE_SRC_FILES := core/network.cpp core/config-file.cpp core/network-interface.cpp core/logger-factory.cpp core/privilege-helper.cpp core/city-hash.cpp core/scheduler.cpp core/global-io.cpp core/logger.cpp core/random.cpp
+LOCAL_SRC_FILES := $(addprefix NFD/,$(NFD_CORE_SRC_FILES))
+LOCAL_CPPFLAGS := -I$(LOCAL_PATH)/nfd-android -I$(LOCAL_PATH)/NFD -I$(LOCAL_PATH)/NFD/core
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/nfd-android $(LOCAL_PATH)/NFD $(LOCAL_PATH)/NFD/core
+include $(BUILD_STATIC_LIBRARY)
+
+# nfd itself
+include $(CLEAR_VARS)
+LOCAL_MODULE := nfd-daemon
+LOCAL_SHARED_LIBRARIES := cryptopp ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
+LOCAL_STATIC_LIBRARIES := nfd-core
+NFD_DAEMON_SRC_FILES := daemon/face/ndnlp-sequence-generator.cpp daemon/face/udp-channel.cpp daemon/face/ndnlp-partial-message-store.cpp daemon/face/ndnlp-parse.cpp daemon/face/face.cpp daemon/face/null-face.cpp daemon/face/tcp-factory.cpp daemon/face/ndnlp-slicer.cpp daemon/face/udp-face.cpp daemon/face/multicast-udp-face.cpp daemon/face/channel.cpp daemon/face/tcp-channel.cpp daemon/face/tcp-face.cpp daemon/face/udp-factory.cpp daemon/main.cpp daemon/table/measurements-accessor.cpp daemon/table/pit-out-record.cpp daemon/table/fib-entry.cpp daemon/table/pit-in-record.cpp daemon/table/measurements-entry.cpp daemon/table/strategy-choice.cpp daemon/table/cs-entry.cpp daemon/table/pit.cpp daemon/table/measurements.cpp daemon/table/strategy-info-host.cpp daemon/table/pit-face-record.cpp daemon/table/fib.cpp daemon/table/cs-entry-impl.cpp daemon/table/fib-nexthop.cpp daemon/table/name-tree.cpp daemon/table/name-tree-entry.cpp daemon/table/cs.cpp daemon/table/pit-entry.cpp daemon/table/strategy-choice-entry.cpp daemon/table/cs-skip-list-entry.cpp daemon/table/dead-nonce-list.cpp daemon/fw/access-strategy.cpp daemon/fw/retransmission-suppression.cpp daemon/fw/strategy.cpp daemon/fw/rtt-estimator.cpp daemon/fw/broadcast-strategy.cpp daemon/fw/client-control-strategy.cpp daemon/fw/best-route-strategy.cpp daemon/fw/face-table.cpp daemon/fw/ncc-strategy.cpp daemon/fw/forwarder.cpp daemon/fw/best-route-strategy2.cpp daemon/fw/available-strategies.cpp daemon/mgmt/status-server.cpp daemon/mgmt/tables-config-section.cpp daemon/mgmt/channel-status-publisher.cpp daemon/mgmt/strategy-choice-publisher.cpp daemon/mgmt/general-config-section.cpp daemon/mgmt/command-validator.cpp daemon/mgmt/internal-face.cpp daemon/mgmt/fib-enumeration-publisher.cpp daemon/mgmt/face-manager.cpp daemon/mgmt/manager-base.cpp daemon/mgmt/face-status-publisher.cpp daemon/mgmt/strategy-choice-manager.cpp daemon/mgmt/face-query-status-publisher.cpp daemon/mgmt/fib-manager.cpp
+LOCAL_SRC_FILES := $(addprefix NFD/,$(NFD_DAEMON_SRC_FILES))
+LOCAL_CPPFLAGS := -I$(LOCAL_PATH)/NFD/daemon
+include $(BUILD_SHARED_LIBRARY)
+
+# rib manager
+include $(CLEAR_VARS)
+LOCAL_MODULE := nfd-rib
+LOCAL_SHARED_LIBRARIES := cryptopp ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
+LOCAL_STATIC_LIBRARIES := nfd-core
+NFD_DAEMON_SRC_FILES := rib/fib-update.cpp rib/main.cpp rib/remote-registrator.cpp rib/rib-entry.cpp rib/rib-manager.cpp rib/rib-status-publisher.cpp rib/rib.cpp
+LOCAL_SRC_FILES := $(addprefix NFD/,$(NFD_DAEMON_SRC_FILES))
+LOCAL_CPPFLAGS := -I$(LOCAL_PATH)/NFD/rib
+include $(BUILD_SHARED_LIBRARY)
diff --git a/app/src/main/jni/sqlite3 b/app/src/main/jni/sqlite3
new file mode 160000
index 0000000..b2b9ab5
--- /dev/null
+++ b/app/src/main/jni/sqlite3
@@ -0,0 +1 @@
+Subproject commit b2b9ab529987de81585ce6bf7bcfab91917f37af