jni: Upgrade underlying NFD to version 0.6.2-11-gd657d53
This change replaces in-project JNI compilation of ndn-cxx and NFD with
packaged versions of ndn-cxx and NFD using a customized
android-crew-staging (https://github.com/named-data-mobile/android-crew-staging).
Refer to README-dev.md for more detail.
This commit also drops Logcat views
Refs: #4661
Change-Id: Id981689475d9da3aea63bea38d925f335c25b46e
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index d0d1c02..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,8 +0,0 @@
-[submodule "app/src/main/jni/ndn-cxx"]
- path = app/src/main/jni/ndn-cxx
- url = https://github.com/named-data-mobile/ndn-cxx
- branch = 0.6.0-android-hotfix
-[submodule "app/src/main/jni/NFD"]
- path = app/src/main/jni/NFD
- url = https://github.com/named-data-mobile/NFD
- branch = 0.6.0-android-hotfix
diff --git a/.jenkins.d/10-get-sdk.sh b/.jenkins.d/10-get-sdk.sh
index 2780c32..8d02423 100755
--- a/.jenkins.d/10-get-sdk.sh
+++ b/.jenkins.d/10-get-sdk.sh
@@ -14,7 +14,7 @@
export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
echo "y" | sdkmanager "platform-tools"
-sdkmanager "platforms;android-26" "build-tools;26.0.3"
+sdkmanager "platforms;android-28"
cd ..
diff --git a/.jenkins.d/20-get-ndk.sh b/.jenkins.d/20-get-ndk.sh
index 6548c94..df8bd88 100755
--- a/.jenkins.d/20-get-ndk.sh
+++ b/.jenkins.d/20-get-ndk.sh
@@ -3,7 +3,7 @@
set -x
android-sdk-linux/tools/bin/sdkmanager "ndk-bundle"
-git clone https://github.com/cawka/android-crew-staging.git android-sdk-linux/ndk-bundle/crew.dir
+git clone https://github.com/named-data-mobile/android-crew-staging.git android-sdk-linux/ndk-bundle/crew.dir
if [[ ! -z $GEM_PATH ]]; then
# Hack for unset GEM_PATH in crew tool
@@ -18,9 +18,9 @@
export PATH=`pwd`:$PATH
fi
-export CREW_OWNER=cawka
-# export CREW_DOWNLOAD_BASE=http://irl.cs.ucla.edu/~cawka/android-crew-staging/staging/
+export CREW_OWNER=named-data-mobile
-android-sdk-linux/ndk-bundle/crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
+android-sdk-linux/ndk-bundle/crew.dir/crew install target/sqlite target/openssl target/boost
+android-sdk-linux/ndk-bundle/crew.dir/crew install target/ndn_cxx target/nfd
echo ndk.dir=`pwd`/android-sdk-linux/ndk-bundle >> local.properties
diff --git a/.vagrant/Vagrantfile b/.vagrant/Vagrantfile
index 0423794..46b4c75 100644
--- a/.vagrant/Vagrantfile
+++ b/.vagrant/Vagrantfile
@@ -22,12 +22,13 @@
export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
echo "y" | sdkmanager "platform-tools"
- sdkmanager "platforms;android-26" "build-tools;26.0.3" "ndk-bundle"
+ sdkmanager "platforms;android-28" "ndk-bundle"
cd ndk-bundle
- git clone https://github.com/cawka/android-crew-staging.git crew.dir
+ git clone https://github.com/named-data-mobile/android-crew-staging.git crew.dir
- CREW_OWNER=cawka crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
+ CREW_OWNER=named-data-mobile crew.dir/crew install target/sqlite target/openssl target/boost
+ CREW_OWNER=named-data-mobile crew.dir/crew install target/ndn_cxx target/nfd
cd ../..
diff --git a/README-dev.md b/README-dev.md
index c070b2a..1c5b308 100644
--- a/README-dev.md
+++ b/README-dev.md
@@ -1,14 +1,12 @@
Developer Notes
===============
-## To build debug version of NFD
+## To build debug version of NDN-Android
Configure `ndk.dir` and `sdk.dir` in `local.properties` file. For example:
- ndk.dir=/opt/crystax-ndk-10.3.1
- sdk.dir=/opt/android-sdk-macosx
-
-Alternatively, you can set `ANDROID_NDK_ROOT` environment variable to point towards NDK folder.
+ sdk.dir=/opt/android-sdk
+ ndk.dir=/opt/android-sdk/ndk-bundle
Build process can be customized using several environment variables:
@@ -18,17 +16,6 @@
NDK_DEBUG=1 ./gradlew assembleDebug
-- `NDK_BUILD_ABI=<comma-separated-list-of-platforms>`
-
- If set, the native code is built only for the specified platforms. For example, the following snippet will build NFD only for x86 platform:
-
- export NDK_BUILD_ABI=x86
- ./gradlew assembleDebug
-
-- `NDK_BUILD_PARALLEL=<number>`
-
- If set, the build will be limited with the specified number of parallel builds. Otherwise, the build will be automatically parallelized based on the number of available CPUs.
-
## To build the release version of NFD
In order to build the release version of NFD, it needs to be properly signed. In order to specify keystore, keystore's password, key in the keystore, and key's password, add the following configuration into `local.properties` file:
@@ -39,7 +26,7 @@
keystore.key.alias=<key-alias-in-keystore>
keystore.key.password=<key-password>
-For more information about application signing and instructions on how to generate keys, refer to [Android Documentation](http://developer.android.com/tools/publishing/app-signing.html).
+For more information about application signing and instructions on how to generate keys, refer to [Android Documentation](https://developer.android.com/studio/publish/app-signing).
## To publish the release version on Google Play
@@ -48,3 +35,122 @@
google-play=<path-to-json-config>
Note that `.json` config can be downloaded from Google Developer Console. For more information, refer to [Google Play Publishing Plugin](https://github.com/Triple-T/gradle-play-publisher).
+
+## Building NDN-Android with different version of underlying NFD, ndn-cxx, or other dependencies
+
+NDN-Android build assumes existence of prebuilt binaries (=shared libraries) for all dependencies, including NFD, ndn-cxx, boost, sqlite, libssl. As of version 0.6.2-1, these dependencies are managed by an external tool called [crew tool](https://github.com/named-data-mobile/android-crew-staging), a hacked version of the official tool that was designed for [CrystaX NDK](https://github.com/crystax/android-crew-staging) (the hacked version targeting the official NDK r18, support specifically clang, and not all packages would work).
+
+The basic workflow with the crew tool is as follows:
+
+- Getting the tool into the right place relative to NDK folder:
+
+ cd /opt/android-sdk/android-ndk
+ git clone https://github.com/named-data-mobile/android-crew-staging crew.dir
+
+- Installing precompiled binary (downloaded from Github relese page)
+
+ ./crew.dir/crew install target/<package>[:<version>]
+
+ `target/` indicates that the package is intended for Android target. The official tool also supports installing dependencies for the host system (`host/`), but the hacked version has not been tested for that.
+
+ `<package>` one of the available packages.
+
+ `:<version>` an optional version, in case there are multiple versions available
+
+ To get list of all available packages and their versions, you can use `./crew.dir/crew list` command.
+
+- Installing packages from source
+
+ The process is similar to installing precompiled binary but split into two stages: getting source and actually building the package
+
+ Get the source
+
+ ./crew.dir/crew source <package>[:<version>]
+
+ Build
+
+ ./crew.dir/crew build target/<package>[:<version>]
+
+ The `source` command downloading source of the specified package (URL or git repo defined in `crew.dir/formula/packages/<package>.rb` --- note that getting code from git repo may fail with old versions of ruby. If you are getting strange segfaults, try using a different version of ruby, known to work with version 2.5.1p57). After downloading, it will apply any patches for the package version in `./crew.dir/patches/packages/<package>/<version>` (all `.patch` files will be applied to the source).
+
+ If additional patches need to be applied or old patch re-applied, you need to remove source and add source again:
+
+ ./crew.dir/crew remove-source <package>[:<version>]
+ ./crew.dir/crew source <package>[:<version>]
+
+ NOTE. To build package from a different source code, you need to modify the package definition (`./crew.dir/formula/packages/<package>.rb`): source code can be downloaded from an online archive or any git source (using tag or commit-id). See the existing packages for reference.
+
+- To delete the downloaded version of a package:
+
+ ./crew.dir/crew remove <package>[:<version>]
+
+- To delete source and the built version of a package:
+
+ ./crew.dir/crew remove-source <package>[:<version>]
+ ./crew.dir/crew remove <package>[:<version>]
+
+Note that whenever `ndn_cxx`, `nfd`, or dependencies package is (re-)built or (re-)installed, you just need to clean and re-build NDN-android (`./gradlew clean` and `./gradlew assembleDebug`). It will automatically use the available package. However, if you changed version of built/installed NFD, you will need to update `app/src/main/jni/Android.mk`, which hardcodes the specific version of NFD package. All other dependencies are transitively defined by the crew tool and do not need to be explicitly defined.
+
+### Quick reference for crew tool internals
+
+A trimmed file structure:
+
+ ├── etc
+ │ ├── ca-certificates.crt
+ │ └── shasums.txt
+ ├── library
+ │ ├── arch.rb
+ │ ├── base_package.rb
+ │ ├── build.rb
+ │ ├── build_dependency.rb
+ │ ├── cmd
+ │ │ ├── <...>.rb
+ │ ├── command_options.rb
+ │ ├── compiler_wrapper_helper.rb
+ │ ├── deb.rb
+ │ ├── exceptions.rb
+ │ ├── extend
+ │ │ ├── dir.rb
+ │ │ └── module.rb
+ │ ├── formula.rb
+ │ ├── formulary.rb
+ │ ├── github.rb
+ │ ├── global.rb
+ │ ├── host_base.rb
+ │ ├── multi_version.rb
+ │ ├── package.rb
+ │ ├── patch.rb
+ │ ├── platform.rb
+ │ ├── properties.rb
+ │ ├── release.rb
+ │ ├── shasum.rb
+ │ ├── single_version.rb
+ │ ├── target_base.rb
+ │ ├── tool.rb
+ │ ├── toolchain.rb
+ │ ├── utility.rb
+ │ └── utils.rb
+ ├── formula
+ │ ├── packages
+ │ │ ├── <package-formula>.rb
+ │ └── tools
+ │ ├── <tool>.rb
+ │ └── ....rb
+ ├── patches
+ │ ├── packages
+ │ │ ├── <package-name>
+ │ │ │ └── <package-version>
+ │ │ │ ├── <file1>.patch
+ │ │ │ ├── <file2>.patch
+ │ │ │ └── ...
+
+
+Notable places:
+
+- `formula/packages/<package-formula>.rb`: ruby scripts defining formula where to download source, dependencies, and how to build the package
+
+- `patches/packages/<package-name>/<package-version>/`: patch files to be applied for a version of a package
+
+- `library/toolchain.rb`: definition of the toolchains, including necessary compilation flags for different platforms.
+
+- `library/package.rb`: default/available options to customize package build and basic build stages. Note that to build a package, crew tool creates "compiler wrapper" placed in the build directory of a package using the specified name. This wrapper, internally, runs a proper compiler executable with any additional parameters (as defined in `library/toolchain.rb`). Depending on the options defined for the package, the wrapper can also "wrap" compilation and linking flags, but it may not work. Normally, during the build, the crew tool defines `CFLAGS`, `CXXGLAGS`, `LDFLAGS`, and bunch of other flags (including paths to various tools such as nm, ar, etc.).
diff --git a/README.md b/README.md
index af28fd9..2ccb0a7 100644
--- a/README.md
+++ b/README.md
@@ -26,28 +26,39 @@
export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
echo "y" | sdkmanager "platform-tools"
- sdkmanager "platforms;android-26" "build-tools;26.0.3" "ndk-bundle"
+ sdkmanager "platforms;android-28" "ndk-bundle"
cd ndk-bundle
- git clone https://github.com/cawka/android-crew-staging.git crew.dir
+ git clone https://github.com/named-data-mobile/android-crew-staging crew.dir
- CREW_OWNER=cawka crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
+ CREW_OWNER=named-data-mobile crew.dir/crew install target/sqlite target/openssl target/boost
+ CREW_OWNER=named-data-mobile crew.dir/crew install target/ndn_cxx target/nfd
cd ..
The above `crew` scripts will install pre-compiled versions of sqlite, openssl, and boost libraries.
-To compile them instead, replace `install` with `build`.
+For more details about the crew tool, refer to README-dev.md.
## 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`/android-sdk-linux/ndk-bundle >> NFD-android/local.properties
cd NFD-android
+ # Build in release mode (you will need to have proper signing keys configured, see README-dev.md)
./gradlew assembleRelease
+ # Build in debug mode
+ ./gradlew assembleDebug
+
+You can also automatically install debug/release NDN-android to the connected phone
+
+ # build and install release version (will require signing key configuration)
+ ./gradlew installRelease
+
+ # build and install debug version
+ ./gradlew installDebug
Note that you can limit architectures being built using `NDK_BUILD_ABI` variable. For example,
@@ -58,6 +69,10 @@
By default, the build script will try to parallelize build to the number of CPUs. This can be
overridden using `NDK_BUILD_PARALLEL` variable.
+To upload `.apk` files to Google Play (need configuration of keys and Google Play credentials, see README-dev.md):
+
+ ./gradlew publishRelease
+
## Setting up environment using Vagrant
The development setup can be set up with [Vagrant](https://www.vagrantup.com/) and scripts provided
diff --git a/app/build.gradle b/app/build.gradle
index de674a8..3dc9643 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,15 +3,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 26
- buildToolsVersion "26.0.3"
+ compileSdkVersion 28
defaultConfig {
applicationId "net.named_data.nfd"
minSdkVersion 23
targetSdkVersion 23
- versionCode 4007
- versionName "0.3.0 (NFD 0.6.0, ndn-cxx 0.6.0)"
+ versionCode 4008
+ versionName "0.6.2-1 (NFD 0.6.2-11-gd657d53)"
multiDexEnabled true
}
compileOptions {
@@ -143,25 +142,25 @@
mavenLocal()
mavenCentral()
maven {
- url "https://oss.sonatype.org/content/repositories/snapshots/"
+ url "https://oss.sonatype.org/content/repositories/releases/"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:26.1.0'
- implementation 'com.android.support:support-v4:26.1.0'
- implementation 'com.android.volley:volley:1.0.0'
+ implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
+ implementation 'com.android.support:support-v4:28.0.0-alpha3'
+ implementation 'com.android.volley:volley:1.1.1'
- implementation('com.intel.jndn.management:jndn-management:1.1.3') {
+ implementation('net.named-data.jndn-extra:jndn-management:1.2.0') {
exclude group: 'net.named-data', module: 'jndn'
}
- implementation('net.named-data:jndn-android:0.15') {
+ implementation('net.named-data:jndn-android:0.17') {
exclude group: 'org.xerial'
exclude group: 'com.google.android'
}
- implementation 'net.named-data.jndn-xx:jndn-xx-util:0.0.1'
- implementation 'joda-time:joda-time:2.9.9'
+ implementation 'net.named-data.jndn-extra:jndn-xx-util:0.0.2'
+ implementation 'joda-time:joda-time:2.10'
}
Properties properties = new Properties()
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 948b73b..51c923b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,11 +3,11 @@
package="net.named_data.nfd" >
<uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
diff --git a/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java b/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
index 143ed58..0d58cd3 100644
--- a/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
+++ b/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
@@ -1,6 +1,6 @@
/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2017 Regents of the University of California
+ * Copyright (c) 2015-2018 Regents of the University of California
* <p/>
* This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
* See AUTHORS.md for complete list of NFD Android authors and contributors.
@@ -125,10 +125,10 @@
listItems.add(new ListItem(R.string.link_type, getLinkType(faceStatus.getLinkType())));
listItems.add(new ListItem(R.string.in_interests, String.valueOf(
faceStatus.getNInInterests())));
- listItems.add(new ListItem(R.string.in_data, String.valueOf(faceStatus.getNInDatas())));
+ listItems.add(new ListItem(R.string.in_data, String.valueOf(faceStatus.getNInData())));
listItems.add(new ListItem(R.string.out_interests, String.valueOf(
faceStatus.getNOutInterests())));
- listItems.add(new ListItem(R.string.out_data, String.valueOf(faceStatus.getNOutDatas())));
+ listItems.add(new ListItem(R.string.out_data, String.valueOf(faceStatus.getNOutData())));
listItems.add(new ListItem(R.string.in_bytes, String.valueOf(faceStatus.getNInBytes())));
listItems.add(new ListItem(R.string.out_bytes, String.valueOf(faceStatus.getNOutBytes())));
diff --git a/app/src/main/java/net/named_data/nfd/LogcatFragment.java b/app/src/main/java/net/named_data/nfd/LogcatFragment.java
deleted file mode 100644
index ed4b1e8..0000000
--- a/app/src/main/java/net/named_data/nfd/LogcatFragment.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015 Regents of the University of California
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
- * See AUTHORS.md for complete list of NFD Android authors and contributors.
- *
- * NFD Android 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 Android 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 Android, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.named_data.nfd;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import net.named_data.nfd.utils.G;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-
-/**
- * Logcat fragment that houses the output of LogCat in a ListView for viewing.
- *
- * The ListView is backed by a {@link net.named_data.nfd.LogcatFragment.LogListAdapter}
- * that that limits the number of logs that are being displayed to the user. This
- * prevents the ListView from growing indeterminately. This maximum number of
- * log lines that is allowed to be displayed is set by
- * {@link net.named_data.nfd.LogcatFragment#s_logMaxLines}.
- *
- */
-public class LogcatFragment extends Fragment {
-
- public static Fragment newInstance() {
- return new LogcatFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setHasOptionsMenu(true);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState) {
- @SuppressLint("InflateParams")
- View v = inflater.inflate(R.layout.fragment_logcat_output, null);
-
- // Get UI Elements
- m_logListView = (ListView) v.findViewById(R.id.log_output);
- m_logListAdapter = new LogListAdapter(inflater, s_logMaxLines);
- m_logListView.setAdapter(m_logListAdapter);
-
- return v;
- }
-
- @Override
- public void onResume() {
- super.onResume();
- startLogging();
- G.Log("LogcatFragment(): onResume()");
- }
-
- @Override
- public void onPause() {
- super.onPause();
- stopLogging();
- G.Log("LogcatFragment(): onPause()");
- }
-
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- super.onCreateOptionsMenu(menu, inflater);
- inflater.inflate(R.menu.menu_log, menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.action_log_settings:
- m_callbacks.onDisplayLogcatSettings();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- m_callbacks = (Callbacks) activity;
- } catch (ClassCastException e) {
- G.Log("Hosting activity must implement callback.");
- throw e;
- }
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- m_callbacks = null;
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /**
- * Starts logging by spawning a new thread to capture logs.
- */
- private void startLogging() {
- // Clear output, update UI and get tag arguments
- clearLogOutput();
- appendLogText(getString(R.string.loading_logger));
- m_tagArguments = LogcatSettingsManager.get(getActivity()).getTags();
-
- new Thread(){
- @Override
- public void run() {
- captureLog();
- G.Log("Thread done capturing logs.");
- }
- }.start();
- }
-
- /**
- * Stops the logging by killing the process running logcat.
- */
- private void stopLogging() {
- // Kill process
- m_logProcess.destroy();
- }
-
- /**
- * Clear log adapter and update UI.
- */
- private void clearLogOutput() {
- m_logListAdapter.clearMessages();
- }
-
- /**
- * Convenience method to append a message to the log output
- * and scroll to the bottom of the log.
- *
- * @param message String message to be posted to the text view.
- */
- private void appendLogText(String message) {
- m_logListAdapter.addMessage(message);
- m_logListView.setSelection(m_logListAdapter.getCount() - 1);
- }
-
- /**
- * Convenience method to capture the output from logcat.
- */
- private void captureLog() {
- try {
- /**
- * NOTE: The use of the 'time' log output format is hard
- * coded for now. This option is similar to that of the
- * log output that is seen in Android Studio and Eclipse.
- *
- * In the future this value can be user configurable or
- * placed in the log preference settings.
- */
- // Build command for execution
- String cmd = String.format("%s -v time %s *:S",
- "logcat",
- m_tagArguments);
-
- G.Log("LogCat Command: " + cmd);
-
- m_logProcess = Runtime.getRuntime().exec(cmd);
- BufferedReader in = new BufferedReader(
- new InputStreamReader(m_logProcess.getInputStream()));
-
- String line;
- while ((line = in.readLine()) != null) {
- final String message = line;
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- appendLogText(message);
- }
- });
- }
-
- // Wait for process to join this thread
- m_logProcess.waitFor();
- } catch (IOException | InterruptedException e) {
- G.Log("captureLog(): " + e);
- }
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /**
- * Custom LogListAdapter to limit the number of log lines that
- * is being stored and displayed.
- */
- private static class LogListAdapter extends BaseAdapter {
-
- /**
- * Create a ListView compatible adapter with an
- * upper bound on the maximum number of entries that will
- * be displayed in the ListView.
- *
- * @param maxLines Maximum number of entries allowed in
- * the ListView for this adapter.
- */
- public LogListAdapter(LayoutInflater layoutInflater, int maxLines) {
- m_data = new ArrayList<>();
- m_layoutInflater = layoutInflater;
- m_maxLines = maxLines;
- }
-
- /**
- * Add a message to be displayed in the log's list view.
- *
- * @param message Message to be added to the underlying data store
- * and displayed on thi UI.
- */
- public void addMessage(String message) {
- if (m_data.size() == m_maxLines) {
- m_data.get(0);
- }
-
- m_data.add(message);
- notifyDataSetChanged();
- }
-
- /**
- * Convenience method to clear all messages from the underlying
- * data store and update the UI.
- */
- public void clearMessages() {
- m_data.clear();
- this.notifyDataSetChanged();
- }
-
- @Override
- public int getCount() {
- return m_data.size();
- }
-
- @Override
- public Object getItem(int position) {
- return m_data.get(position);
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @SuppressLint("InflateParams")
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- LogEntryViewHolder holder;
-
- if (convertView == null) {
- holder = new LogEntryViewHolder();
-
- convertView = m_layoutInflater.inflate(R.layout.list_item_log, null);
- convertView.setTag(holder);
-
- holder.logLineTextView = (TextView) convertView.findViewById(R.id.log_line);
- } else {
- holder = (LogEntryViewHolder) convertView.getTag();
- }
-
- holder.logLineTextView.setText(m_data.get(position));
- return convertView;
- }
-
- /** Underlying message data store for log messages*/
- private final ArrayList<String> m_data;
-
- /** Layout inflater for inflating views */
- private final LayoutInflater m_layoutInflater;
-
- /** Maximum number of log lines to display */
- private final int m_maxLines;
- }
-
- /**
- * Log entry view holder object for holding the output.
- */
- private static class LogEntryViewHolder {
- public TextView logLineTextView;
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- public interface Callbacks {
- void onDisplayLogcatSettings();
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /** Maximum number of log lines to be displayed by the backing adapter of the ListView */
- private static final int s_logMaxLines = 380;
-
- /** Process in which logcat is running in */
- private Process m_logProcess;
-
- /** ListView for displaying log output in */
- private ListView m_logListView;
-
- /** Customized ListAdapter for controlling log output */
- private LogListAdapter m_logListAdapter;
-
- /** Tag argument to logcat */
- private String m_tagArguments;
-
- /** Callback reference to hosting activity */
- private Callbacks m_callbacks;
-}
diff --git a/app/src/main/java/net/named_data/nfd/LogcatSettingItem.java b/app/src/main/java/net/named_data/nfd/LogcatSettingItem.java
deleted file mode 100644
index d5a3fff..0000000
--- a/app/src/main/java/net/named_data/nfd/LogcatSettingItem.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015 Regents of the University of California
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
- * See AUTHORS.md for complete list of NFD Android authors and contributors.
- *
- * NFD Android 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 Android 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 Android, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.named_data.nfd;
-
-/**
- * Logcat setting item that contains information about the tag name
- * in the m_logTag field and log level in the m_logLevel field.
- */
-public class LogcatSettingItem {
-
- public LogcatSettingItem(String logTag, String logLevel) {
- m_logTag = logTag;
- m_logLevel = logLevel;
- }
-
- public String getLogTag() {
- return m_logTag;
- }
-
- public void setLogTag(String logTag) {
- m_logTag = logTag;
- }
-
- public String getLogLevel() {
- return m_logLevel;
- }
-
- public void setLogLevel(String logLevel) {
- m_logLevel = logLevel;
- }
-
- @Override
- public String toString() {
- return String.format("%s: %s", m_logTag, m_logLevel);
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /** Log tag that logcat should monitor */
- private String m_logTag;
-
- /** Log level (aka priority level) that logcat should use for this log tag */
- private String m_logLevel;
-}
diff --git a/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java b/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java
deleted file mode 100644
index 1cb1b82..0000000
--- a/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2015-2017 Regents of the University of California
- * <p/>
- * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
- * See AUTHORS.md for complete list of NFD Android authors and contributors.
- * <p/>
- * NFD Android 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.
- * <p/>
- * NFD Android 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.
- * <p/>
- * You should have received a copy of the GNU General Public License along with
- * NFD Android, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.named_data.nfd;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.DialogFragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.ListFragment;
-import android.support.v4.content.ContextCompat;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-
-public class LogcatSettingsFragment extends ListFragment {
-
- public static LogcatSettingsFragment newInstance() {
- return new LogcatSettingsFragment();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setHasOptionsMenu(true);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState)
- {
- super.onViewCreated(view, savedInstanceState);
-
- View v = getLayoutInflater().inflate(R.layout.fragment_logcat_tags_list_header, getListView(), false);
- getListView().addHeaderView(v, null, false);
- getListView().setDivider(ContextCompat.getDrawable(getContext(), R.drawable.list_item_divider));
-
- // @TODO implement log item removal
- // ListView listView = (ListView) v.findViewById(android.R.id.list);
- // listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
- // listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
- // @Override
- // public void onItemCheckedStateChanged(ActionMode mode,
- // int position,
- // long id,
- // boolean checked)
- // {
- // // Nothing to do here
- // }
- //
- // @Override
- // public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- // MenuInflater inflater = mode.getMenuInflater();
- // inflater.inflate(R.menu.menu_logcat_settings_multiple_modal_menu, menu);
- // return true;
- // }
- //
- // @Override
- // public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- // return false;
- // }
- //
- // @Override
- // public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
- // switch (item.getItemId()) {
- // case R.id.menu_item_delete_setting_item:
- // // TODO: Delete log item tag
- // return true;
- // default:
- // return false;
- // }
- // }
- //
- // @Override
- // public void onDestroyActionMode(ActionMode mode) {
- // // Nothing to do here
- // }
- // });
- }
-
- @Override
- public void onActivityCreated(@Nullable Bundle savedInstanceState)
- {
- super.onActivityCreated(savedInstanceState);
-
- if (m_adapter == null) {
- m_logcatSettingsManager = LogcatSettingsManager.get(getActivity());
- m_logcatSettingItems = m_logcatSettingsManager.getLogcatSettingItems();
-
- m_adapter = new LogcatSettingsAdapter(getActivity(), m_logcatSettingItems);
- }
- // setListAdapter must be called after addHeaderView. Otherwise, there is an exception on some platforms.
- // http://stackoverflow.com/a/8141537/2150331
- setListAdapter(m_adapter);
- }
-
- @Override
- public void onDestroyView()
- {
- super.onDestroyView();
- setListAdapter(null);
- }
-
- @Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
- {
- super.onCreateOptionsMenu(menu, inflater);
- inflater.inflate(R.menu.menu_logcat_settings, menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item)
- {
- switch (item.getItemId()) {
- case R.id.action_log_settings:
- FragmentManager fm = getActivity().getSupportFragmentManager();
- ResetLogLevelDialog dialog
- = ResetLogLevelDialog.newInstance(getString(R.string.reset_log_level_dialog_title));
- dialog.setTargetFragment(LogcatSettingsFragment.this, REQUEST_CODE_DIALOG_RESET_ALL_LOG_LEVELS);
- dialog.show(fm, DIALOG_RESET_ALL_LOG_LEVELS_TAG);
-
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
- @Override
- public void onListItemClick(ListView l, View v, int position, long id) {
- final String logTag = m_logcatSettingItems.get(position).getLogTag();
-
- final FragmentManager fm = getActivity().getSupportFragmentManager();
- final ResetLogLevelDialog dialog = ResetLogLevelDialog.newInstance(logTag, position);
-
- dialog.setTargetFragment(LogcatSettingsFragment.this, REQUEST_CODE_DIALOG_SET_LOG_LEVEL);
- dialog.show(fm, DIALOG_SET_LOG_LEVEL_TAG);
- }
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode != Activity.RESULT_OK) {
- return;
- }
-
- String newLogLevel;
- switch (requestCode) {
- case REQUEST_CODE_DIALOG_RESET_ALL_LOG_LEVELS:
- newLogLevel = data.getStringExtra(ResetLogLevelDialog.EXTRA_RESET_LOG_LEVEL_VALUE);
-
- // Update settings
- for (LogcatSettingItem item : m_logcatSettingItems) {
- item.setLogLevel(newLogLevel);
- }
-
- // Update UI
- updateListUI();
-
- // Save setting items
- m_logcatSettingsManager.saveSettingItems();
- break;
- case REQUEST_CODE_DIALOG_SET_LOG_LEVEL:
- newLogLevel = data.getStringExtra(ResetLogLevelDialog.EXTRA_RESET_LOG_LEVEL_VALUE);
- final int listPosition
- = data.getIntExtra(ResetLogLevelDialog.EXTRA_LOG_ITEM_LIST_POSITION, -1);
-
- if (listPosition != -1) {
- m_logcatSettingItems.get(listPosition).setLogLevel(newLogLevel);
-
- // Update UI
- updateListUI();
-
- // Save setting items
- m_logcatSettingsManager.saveSettingItems();
- }
- break;
- }
- }
-
- /**
- * Convenience method that updates the UI by notifying the backing list adapter
- * that changes has been made to the underlying data set.
- */
- private void updateListUI() {
- ((LogcatSettingsAdapter) getListAdapter()).notifyDataSetChanged();
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /**
- * Adapter for use by thi ListFragment that display a list of LogcatSettingItem.
- */
- private static class LogcatSettingsAdapter extends ArrayAdapter<LogcatSettingItem> {
-
- LogcatSettingsAdapter(Context context, ArrayList<LogcatSettingItem> objects) {
- super(context, 0, objects);
- m_layoutInflater = LayoutInflater.from(context);
- }
-
- @Override @NonNull
- public View getView(int position, View convertView, @NonNull ViewGroup parent) {
- SettingItemHolder holder;
-
- if (convertView == null) {
- holder = new SettingItemHolder();
-
- convertView = m_layoutInflater.inflate(R.layout.list_item_setting_item, parent, false);
- convertView.setTag(holder);
-
- holder.m_logTag = convertView.findViewById(R.id.list_item_log_tag);
- holder.m_logLevel = convertView.findViewById(R.id.list_item_setting_log_level);
- } else {
- holder = (SettingItemHolder) convertView.getTag();
- }
-
- LogcatSettingItem item = getItem(position);
- if (item != null) {
- holder.m_logTag.setText(item.getLogTag());
- holder.m_logLevel.setText(item.getLogLevel());
- }
-
- return convertView;
- }
-
- private static class SettingItemHolder {
- private TextView m_logTag;
- private TextView m_logLevel;
- }
-
- private final LayoutInflater m_layoutInflater;
- }
-
- /**
- * Convenient dialog fragment that prompts for the log level value
- * to reset all tags to.
- */
- public static class ResetLogLevelDialog extends DialogFragment {
-
- public static ResetLogLevelDialog newInstance(String dialogTitle) {
- return newInstance(dialogTitle, -1);
- }
-
- public static ResetLogLevelDialog newInstance(String dialogTitle, int listPosition) {
- final Bundle args = new Bundle();
- args.putSerializable(BUNDLE_KEY_DIALOG_TITLE, dialogTitle);
-
- if (listPosition != -1) {
- args.putSerializable(BUNDLE_KEY_DIALOG_LIST_POSITION, listPosition);
- }
-
- final ResetLogLevelDialog fragment = new ResetLogLevelDialog();
- fragment.setArguments(args);
-
- return fragment;
- }
-
- @NonNull
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- final String [] logLevelValues
- = getResources().getStringArray(R.array.reset_log_level_values);
-
- final String dialogTitle = getArguments().getString(BUNDLE_KEY_DIALOG_TITLE);
-
- return new AlertDialog.Builder(getActivity())
- .setTitle(dialogTitle)
- .setItems(
- logLevelValues,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- sendResult(Activity.RESULT_OK, logLevelValues[which]);
- }
- })
- .create();
- }
-
- /**
- * Convenient method to send data back to the fragment that presents this
- * dialog.
- *
- * @param resultCode Result code to be passed back
- * @param logLevelValue Log level value to be passed back
- */
- private void sendResult(int resultCode, String logLevelValue) {
- if (getTargetFragment() == null) {
- return;
- }
-
- // Create intent
- Intent intent = new Intent();
- intent.putExtra(EXTRA_RESET_LOG_LEVEL_VALUE, logLevelValue);
-
- // Fill item position if present
- final int logItemPosition = getArguments().getInt(BUNDLE_KEY_DIALOG_LIST_POSITION, -1);
- if (logItemPosition != -1) {
- intent.putExtra(EXTRA_LOG_ITEM_LIST_POSITION, logItemPosition);
- }
-
- // Send results
- getTargetFragment().onActivityResult(getTargetRequestCode(), resultCode, intent);
- }
-
- /** Unique extra name to be used */
- public static final String EXTRA_RESET_LOG_LEVEL_VALUE
- = "net.named_data.nfd.reset_log_level_value";
-
- public static final String EXTRA_LOG_ITEM_LIST_POSITION
- = "net.named_data.nfd.log_item_list_position";
-
- private static final String BUNDLE_KEY_DIALOG_TITLE
- = "BUNDLE_KEY_DIALOG_TITLE";
-
- private static final String BUNDLE_KEY_DIALOG_LIST_POSITION
- = "BUNDLE_KEY_DIALOG_LIST_POSITION";
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /** Array list that contains all the tags that are logged */
- private ArrayList<LogcatSettingItem> m_logcatSettingItems;
-
- /** Reference to the currently used LogcatSettingsManager */
- private LogcatSettingsManager m_logcatSettingsManager;
-
- /** Request code for dialog that gets the new log level for all tags */
- private static final int REQUEST_CODE_DIALOG_RESET_ALL_LOG_LEVELS = 1;
-
- /** Request code for dialog that gets the new log level for a single tag */
- private static final int REQUEST_CODE_DIALOG_SET_LOG_LEVEL = 2;
-
- /** Unique tag that identifies dialog fragment in the fragment manager */
- private static final String DIALOG_RESET_ALL_LOG_LEVELS_TAG = "ResetAllLogLevelDialog";
-
- /** Unique tag that identifies dialog fragment in the fragment manager */
- private static final String DIALOG_SET_LOG_LEVEL_TAG = "SetLogLevelDialog";
-
- private ArrayAdapter<LogcatSettingItem> m_adapter;
-}
diff --git a/app/src/main/java/net/named_data/nfd/LogcatSettingsManager.java b/app/src/main/java/net/named_data/nfd/LogcatSettingsManager.java
deleted file mode 100644
index e6bffcb..0000000
--- a/app/src/main/java/net/named_data/nfd/LogcatSettingsManager.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015 Regents of the University of California
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
- * See AUTHORS.md for complete list of NFD Android authors and contributors.
- *
- * NFD Android 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 Android 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 Android, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package net.named_data.nfd;
-
-import android.content.Context;
-import android.text.TextUtils;
-
-import net.named_data.nfd.utils.G;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * Manager that controls the loading and saving of tags that are being logged.
- */
-public class LogcatSettingsManager {
-
- private LogcatSettingsManager(Context context) {
- m_context = context;
- m_logcatSettingItems = new ArrayList<>();
- m_logLevelMap = new HashMap<>();
- m_logcatTagsJSONSerializer = new LogcatTagsJSONSerializer(context, NFD_LOGCAT_TAGS_FILENAME);
-
- // Populate log level map
- loadLogLevelMap();
-
- // Check if previous tags setting exists; otherwise load defaults
- if (m_logcatTagsJSONSerializer.logcatTagsFileExists()) {
- loadSettingItems();
- } else {
- loadDefaultSettingItems();
- }
-
- // Save setting items to file
- saveSettingItems();
-
- // Sort log tag name lexicographically
- Collections.sort(m_logcatSettingItems, new Comparator<LogcatSettingItem>() {
- @Override
- public int compare(LogcatSettingItem lhs, LogcatSettingItem rhs) {
- return lhs.getLogTag().compareTo(rhs.getLogTag());
- }
- });
- }
-
- /**
- * Gets the singleton logcat settings manager.
- *
- * @param context Current application context
- * @return The singleton settings manager
- */
- public static LogcatSettingsManager get(Context context) {
- if (s_logcatSettingsManager == null) {
- s_logcatSettingsManager = new LogcatSettingsManager(context.getApplicationContext());
- }
- return s_logcatSettingsManager;
- }
-
- /**
- * Return the current working copy of setting items that are managed by the
- * settings manager.
- *
- * @return Current setting items that are loaded
- */
- public ArrayList<LogcatSettingItem> getLogcatSettingItems() {
- return m_logcatSettingItems;
- }
-
- /**
- * Generate a string representing all the tags to be filtered by logcat
- * and the relevant log levels.
- *
- * An example of a string returned by this method is:
- *
- * <pre>
- * NFDService:S Strategy:S TcpChannel:S TcpFactory:S TcpLocalFace:S UdpFactory:S *:S
- * </pre>
- *
- * @return String representation of the tags and their relevant log levels to be
- * filtered.
- */
- public String getTags() {
- ArrayList<String> arr = new ArrayList<>();
- for (LogcatSettingItem item : m_logcatSettingItems) {
- arr.add(String.format("%s:%s", item.getLogTag(), getPriorityName(item.getLogLevel())));
- }
-
- // Sort and silence everything else by default
- Collections.sort(arr);
- arr.add("*:S");
-
- return TextUtils.join(" ", arr);
- }
-
- /**
- * Convenience method that saves all tags present in m_logcatSettingItems
- * to the persistent JSON storage file.
- */
- public void saveSettingItems() {
- // Create tags map
- Map<CharSequence, CharSequence> map = new HashMap<>();
- for (LogcatSettingItem item : m_logcatSettingItems) {
- map.put(item.getLogTag(), getPriorityName(item.getLogLevel()));
- }
-
- // Save tags
- try {
- m_logcatTagsJSONSerializer.saveTags(map);
- } catch (IOException e) {
- G.Log("saveSettingItems(): Error: " + e);
- }
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /**
- * Convenience method that loads all possible log level priority values as
- * specified by the string array: R.array.logcat_log_level_map.
- */
- private void loadLogLevelMap() {
- for (String item : m_context.getResources().getStringArray(R.array.logcat_log_level_map)) {
- String [] arr = item.split(":");
- m_logLevelMap.put(arr[0], arr[1]);
- }
- }
-
- /**
- * Convenience method that loads default values for tags and log levels that
- * should be used. This method should be invoked when the application does not
- * have previous JSON state information of the tags and log levels.
- */
- private void loadDefaultSettingItems() {
- String [] defaults
- = m_context.getResources().getStringArray(R.array.default_log_tags_and_levels);
- for (String item : defaults) {
- String [] arr = item.split(":");
- m_logcatSettingItems.add(new LogcatSettingItem(arr[0], getVerbosePriorityName(arr[1])));
- }
- }
-
- /**
- * Convenience method that loads all tags that were previously stored and recorded. This
- * method populates m_logcatSettingItems for use in a ListView to present all loaded tags and
- * their relevant log levels.
- */
- private void loadSettingItems() {
- Map<CharSequence, CharSequence> map;
-
- try {
- map = m_logcatTagsJSONSerializer.loadTags();
-
- for (Map.Entry<CharSequence, CharSequence> entry : map.entrySet()) {
- m_logcatSettingItems
- .add(new LogcatSettingItem(entry.getKey().toString(),
- getVerbosePriorityName(entry.getValue().toString())));
- }
- } catch (IOException | NullPointerException e) {
- G.Log("loadSettingItems(): Error in loading tags from file: " + e);
- }
- }
-
- /**
- * Convenience method to get the verbose priority name. For instance, if
- * "V" were passed in, the returned string would be "Verbose". This is
- * dependent on the data that is loaded into m_logLevelMap.
- *
- * @param priority Short form priority name, e.g. "V"
- * @return Verbose priority name, e.g. "Verbose" for a priority argument of "V"
- */
- private String getVerbosePriorityName(String priority) {
- for (Map.Entry<CharSequence, CharSequence> item : m_logLevelMap.entrySet()) {
- if (item.getValue().equals(priority)) {
- return item.getKey().toString();
- }
- }
- return null;
- }
-
- /**
- * Convenience method that gets the priority name from the verbose name. For instance,
- * if "Verbose" were passed in, the returned string would be "V". This is
- * dependent on the data that is loaded into m_logLevelMap.
- *
- * @param priorityVerboseName Verbose priority name, e.g. "Verbose"
- * @return Short form priority name, e.g. "V"
- */
- private String getPriorityName(String priorityVerboseName) {
- return m_logLevelMap.get(priorityVerboseName).toString();
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /**
- * JSON Serializer used to store JSON Tags and relevant settings to
- * a local file. The JSON file format that this serializer stores
- * in the private file is as such:
- *
- * <pre>
- * [
- * {
- * "TcpFactory": "V",
- * "CommandValidator": "V",
- * "RibManager": "V",
- * "Strategy": "V",
- * "FaceTable": "V",
- * "FibManager": "V",
- * "FaceManager": "V",
- * "PrivilegeHelper": "V",
- * "ManagerBase": "V",
- * "TcpChannel": "V",
- * "InternalFace": "V",
- * "TcpLocalFace": "V",
- * "RemoteRegistrator": "V",
- * "GeneralConfigSection": "V",
- * "UdpFactory": "V",
- * "StrategyChoice": "V",
- * "TablesConfigSection": "V"
- * }
- * ]
- * </pre>
- *
- * Each line represents a log tag that is to be monitored as well as the
- * log level to be monitored (aka priority level of log cat). Tags can be any
- * tag for the logger to filter.
- *
- * The log level should be one of the following form:
- *
- * <pre>
- * Log Level | Meaning
- * ===================
- * V : Verbose
- * D : Debug
- * I : Info
- * W : Warning
- * E : Error
- * F : Fatal
- * S : Silent
- * </pre>
- *
- */
- private static class LogcatTagsJSONSerializer {
-
- public LogcatTagsJSONSerializer(Context context, String filename) {
- m_context = context;
- m_filename = filename;
- }
-
- /**
- * Convenience method to save all tags and their respective log levels from the
- * given map. The map should contain key-value pairs of the following format:
- *
- * <pre>
- * "TagName": "V"
- * </pre>
- *
- * @param map Map to be converted saved as a JSON file
- * @throws IOException
- */
- public void saveTags(Map<CharSequence, CharSequence> map) throws IOException {
- // Create JSON Array
- JSONArray array = new JSONArray().put(new JSONObject(map));
-
- BufferedWriter writer = null;
- try {
- OutputStream out = m_context.openFileOutput(m_filename, Context.MODE_PRIVATE);
- writer = new BufferedWriter(new OutputStreamWriter(out));
- writer.write(array.toString());
- } catch (IOException e) {
- G.Log(String.format("saveTags(): Error while writing to file: %s - %s",
- m_filename, e));
- } finally {
- if (writer != null) {
- writer.close();
- }
- }
- }
-
- /**
- * Convenience method to load all tags that were previously saved to a JSON
- * file. The format depends on what was previously stored in the JSON file,
- * but it is recommended to following the format set out in
- * {@link
- * net.named_data.nfd.LogcatSettingsManager.LogcatTagsJSONSerializer#saveTags(java.util.Map)}
- *
- * @return Map that was previously stored in the JSON file
- * @throws IOException
- */
- public Map<CharSequence, CharSequence> loadTags() throws IOException {
- Map<CharSequence, CharSequence> map = new HashMap<>();
-
- BufferedReader reader = null;
- try {
- InputStream inputStream = m_context.openFileInput(m_filename);
- reader = new BufferedReader(new InputStreamReader(inputStream));
- StringBuilder jsonString = new StringBuilder();
- String line;
- while ((line = reader.readLine()) != null) {
- jsonString.append(line);
- }
-
- // Parse JSON array
- JSONArray array = (JSONArray) new JSONTokener(jsonString.toString()).nextValue();
-
- // Populate map
- for (int i=0; i<array.length(); i++) {
- JSONObject jsonObject = array.getJSONObject(i);
- Iterator<String> iterator = jsonObject.keys();
- while (iterator.hasNext()) {
- String key = iterator.next();
- map.put(key, (CharSequence) jsonObject.get(key));
- }
- }
- } catch (JSONException | IOException e) {
- G.Log(String.format("saveTags(): Error while reading from file: %s - %s",
- m_filename, e));
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
-
- return map;
- }
-
- /**
- * @return true if a previously saved file exists; false otherwise
- */
- public boolean logcatTagsFileExists() {
- return m_context.getFileStreamPath(m_filename).exists();
- }
-
- /** Context for storing and retrieving files */
- private final Context m_context;
-
- /** File name to store JSON */
- private final String m_filename;
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- /** Context for storage and retrieval of logcat settings (e.g. from Preferences or Files) */
- private final Context m_context;
-
- /** Array list that contains all the tags that are logged */
- private final ArrayList<LogcatSettingItem> m_logcatSettingItems;
-
- /** Mapping of log tag description to logcat priority setting */
- private final Map<CharSequence, CharSequence> m_logLevelMap;
-
- /** Reference to JSON Serializer for use */
- private final LogcatTagsJSONSerializer m_logcatTagsJSONSerializer;
-
- /** Singleton reference to a LogcatSettingsManager */
- private static LogcatSettingsManager s_logcatSettingsManager;
-
- /** NFD Logcat Tags JSON filename */
- private static final String NFD_LOGCAT_TAGS_FILENAME = "NFD_LOGCAT_TAGS_FILE";
-}
diff --git a/app/src/main/java/net/named_data/nfd/MainActivity.java b/app/src/main/java/net/named_data/nfd/MainActivity.java
index c3a13ba..a1de558 100644
--- a/app/src/main/java/net/named_data/nfd/MainActivity.java
+++ b/app/src/main/java/net/named_data/nfd/MainActivity.java
@@ -1,6 +1,6 @@
/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2015-2017 Regents of the University of California
+ * Copyright (c) 2015-2018 Regents of the University of California
*
* This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
* See AUTHORS.md for complete list of NFD Android authors and contributors.
@@ -41,7 +41,6 @@
*/
public class MainActivity extends AppCompatActivity
implements DrawerFragment.DrawerCallbacks,
- LogcatFragment.Callbacks,
FaceListFragment.Callbacks,
RouteListFragment.Callbacks
{
@@ -70,8 +69,6 @@
DRAWER_ITEM_PING));
// items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_strategies, 0,
// DRAWER_ITEM_STRATEGIES));
- items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_logcat, 0,
- DRAWER_ITEM_LOGCAT));
items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_wifidirect, 0, DRAWER_ITEM_WIFIDIRECT));
// TODO here we are preloading the NDNController singleton to avoid UI slowdown
@@ -161,9 +158,6 @@
// TODO: Placeholders; Fill these in when their fragments have been created
// case DRAWER_ITEM_STRATEGIES:
// break;
- case DRAWER_ITEM_LOGCAT:
- fragment = LogcatFragment.newInstance();
- break;
case DRAWER_ITEM_WIFIDIRECT:
fragment = WiFiDirectFragment.newInstance();
break;
@@ -182,11 +176,6 @@
}
@Override
- public void onDisplayLogcatSettings() {
- replaceContentFragmentWithBackstack(LogcatSettingsFragment.newInstance());
- }
-
- @Override
public void onFaceItemSelected(FaceStatus faceStatus) {
replaceContentFragmentWithBackstack(FaceStatusFragment.newInstance(faceStatus));
}
@@ -210,7 +199,6 @@
public static final int DRAWER_ITEM_FACES = 2;
public static final int DRAWER_ITEM_ROUTES = 3;
public static final int DRAWER_ITEM_PING = 4;
- //public static final int DRAWER_ITEM_STRATEGIES = 4;
- public static final int DRAWER_ITEM_LOGCAT = 5;
- public static final int DRAWER_ITEM_WIFIDIRECT = 6;
+ //public static final int DRAWER_ITEM_STRATEGIES = X;
+ public static final int DRAWER_ITEM_WIFIDIRECT = 5;
}
diff --git a/app/src/main/java/net/named_data/nfd/MainFragment.java b/app/src/main/java/net/named_data/nfd/MainFragment.java
index 276c6e1..0c6d4ee 100644
--- a/app/src/main/java/net/named_data/nfd/MainFragment.java
+++ b/app/src/main/java/net/named_data/nfd/MainFragment.java
@@ -1,6 +1,6 @@
/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2015-2017 Regents of the University of California
+ * Copyright (c) 2015-2018 Regents of the University of California
* <p>
* This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
* See AUTHORS.md for complete list of NFD Android authors and contributors.
@@ -390,8 +390,8 @@
m_inInterestsView.setText(String.valueOf(fs.getNInInterests()));
m_outInterestsView.setText(String.valueOf(fs.getNOutInterests()));
- m_inDataView.setText(String.valueOf(fs.getNInDatas()));
- m_outDataView.setText(String.valueOf(fs.getNOutDatas()));
+ m_inDataView.setText(String.valueOf(fs.getNInData()));
+ m_outDataView.setText(String.valueOf(fs.getNOutData()));
m_inNacksView.setText(String.valueOf(fs.getNInNacks()));
m_outNacksView.setText(String.valueOf(fs.getNOutNacks()));
diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk
index 762c358..9310d31 100644
--- a/app/src/main/jni/Android.mk
+++ b/app/src/main/jni/Android.mk
@@ -4,9 +4,9 @@
include $(CLEAR_VARS)
LOCAL_MODULE := nfd-wrapper
LOCAL_SRC_FILES := nfd-wrapper.cpp
-LOCAL_SHARED_LIBRARIES := nfd-daemon ndn-cxx boost_system_shared boost_thread_shared
+LOCAL_SHARED_LIBRARIES := nfd_shared ndn_cxx_shared boost_system_shared boost_thread_shared boost_log_shared
LOCAL_LDLIBS := -llog -latomic
+LOCAL_CFLAGS := -DBOOST_LOG_DYN_LINK=1
include $(BUILD_SHARED_LIBRARY)
-include $(LOCAL_PATH_SAVED)/ndn-cxx.mk
-include $(LOCAL_PATH_SAVED)/nfd.mk
+$(call import-module,../packages/nfd/0.6.2-11-gd657d53)
diff --git a/app/src/main/jni/Application.mk b/app/src/main/jni/Application.mk
index 793e7c4..b0e4094 100644
--- a/app/src/main/jni/Application.mk
+++ b/app/src/main/jni/Application.mk
@@ -1,8 +1,8 @@
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
-APP_STL := gnustl_shared
-APP_CPPFLAGS += -fexceptions -frtti -std=c++11
+APP_STL := c++_shared
+APP_CPPFLAGS += -fexceptions -frtti -std=c++14
# -Wno-deprecated-declarations
-NDK_TOOLCHAIN_VERSION := 4.9
+NDK_TOOLCHAIN_VERSION := clang
APP_PLATFORM := android-23
diff --git a/app/src/main/jni/NFD b/app/src/main/jni/NFD
deleted file mode 160000
index e5abc94..0000000
--- a/app/src/main/jni/NFD
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e5abc94540a8987ab8c2fc83f28d6073e2be0b96
diff --git a/app/src/main/jni/ndn-cxx b/app/src/main/jni/ndn-cxx
deleted file mode 160000
index f2e7a03..0000000
--- a/app/src/main/jni/ndn-cxx
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit f2e7a0391eed1670691c1e0a7c644bc2430bb01c
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
deleted file mode 100644
index e79c69d..0000000
--- a/app/src/main/jni/ndn-cxx-android/ndn-cxx-config.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef W_SRC_NDN_CXX_CONFIG_HPP_WAF
-#define W_SRC_NDN_CXX_CONFIG_HPP_WAF
-
-// Uncomment this after switch to clang/libc++
-// #define NDN_CXX_HAVE_STD_TO_STRING 1
-
-#define NDN_CXX_HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR 1
-#define NDN_CXX_HAVE_IS_DEFAULT_CONSTRUCTIBLE 1
-#define NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE 1
-#define NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE 1
-#define NDN_CXX_HAVE_PTHREAD 1
-#define NDN_CXX_HAVE_RT 1
-#define NDN_CXX_HAVE_RTNETLINK 1
-#define NDN_CXX_HAVE_SQLITE3 1
-#define NDN_CXX_HAVE_OPENSSL 1
-#define NDN_CXX_SYSCONFDIR "./etc"
-#define NDN_CXX_NDEBUG 1
-#define NDEBUG 1
-#define HAVE_NDN_CXX_CUSTOM_LOGGER 1
-
-#endif /* W_SRC_NDN_CXX_CONFIG_HPP_WAF */
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logger.cpp b/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logger.cpp
deleted file mode 100644
index 41cae15..0000000
--- a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logger.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "ndn-cxx-custom-logger.hpp"
-#include "ndn-cxx-custom-logging.hpp"
-
-#include <cinttypes>
-#include <stdio.h>
-#include <type_traits>
-
-namespace ndn {
-namespace util {
-
-std::ostream&
-operator<<(std::ostream& os, LogLevel level)
-{
- switch (level) {
- case LogLevel::FATAL:
- return os << "FATAL";
- case LogLevel::NONE:
- return os << "NONE";
- case LogLevel::ERROR:
- return os << "ERROR";
- case LogLevel::WARN:
- return os << "WARN";
- case LogLevel::INFO:
- return os << "INFO";
- case LogLevel::DEBUG:
- return os << "DEBUG";
- case LogLevel::TRACE:
- return os << "TRACE";
- case LogLevel::ALL:
- return os << "ALL";
- }
-
- BOOST_THROW_EXCEPTION(std::invalid_argument("unknown log level " + to_string(static_cast<int>(level))));
-}
-
-LogLevel
-parseLogLevel(const std::string& s)
-{
- if (s == "FATAL")
- return LogLevel::FATAL;
- else if (s == "NONE")
- return LogLevel::NONE;
- else if (s == "ERROR")
- return LogLevel::ERROR;
- else if (s == "WARN")
- return LogLevel::WARN;
- else if (s == "INFO")
- return LogLevel::INFO;
- else if (s == "DEBUG")
- return LogLevel::DEBUG;
- else if (s == "TRACE")
- return LogLevel::TRACE;
- else if (s == "ALL")
- return LogLevel::ALL;
-
- BOOST_THROW_EXCEPTION(std::invalid_argument("unrecognized log level '" + s + "'"));
-}
-
-Logger::Logger(const std::string& name)
- : m_moduleName(name)
-{
- this->setLevel(LogLevel::NONE);
- Logging::addLogger(*this);
-}
-
-} // namespace util
-} // namespace ndn
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logger.hpp b/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logger.hpp
deleted file mode 100644
index c8595fe..0000000
--- a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logger.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NFD_ANDROID_NDN_CXX_ANDROID_NDN_CXX_CUSTOM_LOGGER_HPP
-#define NFD_ANDROID_NDN_CXX_ANDROID_NDN_CXX_CUSTOM_LOGGER_HPP
-
-#include "common.hpp"
-#include <sstream>
-#include <atomic>
-#include <android/log.h>
-
-namespace ndn {
-namespace util {
-
-/** \brief indicates the severity level of a log message
- */
-enum class LogLevel {
- FATAL = -1, ///< fatal (will be logged unconditionally)
- NONE = 0, ///< no messages
- ERROR = 1, ///< serious error messages
- WARN = 2, ///< warning messages
- INFO = 3, ///< informational messages
- DEBUG = 4, ///< debug messages
- TRACE = 5, ///< trace messages (most verbose)
- ALL = 255 ///< all messages
-};
-
-/** \brief output LogLevel as string
- * \throw std::invalid_argument unknown \p level
- */
-std::ostream&
-operator<<(std::ostream& os, LogLevel level);
-
-/** \brief parse LogLevel from string
- * \throw std::invalid_argument unknown level name
- */
-LogLevel
-parseLogLevel(const std::string& s);
-
-/** \brief represents a logger in logging facility
- * \note User should declare a new logger with \p NDN_LOG_INIT macro.
- */
-class Logger
-{
-public:
- explicit
- Logger(const std::string& name);
-
- const std::string&
- getModuleName() const
- {
- return m_moduleName;
- }
-
- bool
- isLevelEnabled(LogLevel level) const
- {
- return m_currentLevel.load(std::memory_order_relaxed) >= level;
- }
-
- void
- setLevel(LogLevel level)
- {
- m_currentLevel.store(level, std::memory_order_relaxed);
- }
-
-private:
- const std::string m_moduleName;
- std::atomic<LogLevel> m_currentLevel;
-};
-
-/** \brief declare a log module
- */
-#define NDN_LOG_INIT(name) \
- namespace { \
- inline ::ndn::util::Logger& getNdnCxxLogger() \
- { \
- static ::ndn::util::Logger logger(BOOST_STRINGIZE(name)); \
- return logger; \
- } \
- } \
- struct ndn_cxx__allow_trailing_semicolon
-
-#define NDN_LOG(level, androidLevel, msg, expression) \
- do { \
- if (getNdnCxxLogger().isLevelEnabled(::ndn::util::LogLevel::level)) { \
- std::ostringstream os; \
- os << expression; \
- __android_log_print(ANDROID_LOG_##androidLevel, \
- getNdnCxxLogger().getModuleName().c_str(), "%s", os.str().c_str()); \
- } \
- } while (false)
-
-#define NDN_LOG_TRACE(expression) NDN_LOG(TRACE, VERBOSE, TRACE, expression)
-#define NDN_LOG_DEBUG(expression) NDN_LOG(DEBUG, DEBUG, DEBUG, expression)
-#define NDN_LOG_INFO(expression) NDN_LOG(INFO, INFO, INFO, expression)
-#define NDN_LOG_WARN(expression) NDN_LOG(WARN, WARN, WARNING, expression)
-#define NDN_LOG_ERROR(expression) NDN_LOG(ERROR, ERROR, ERROR, expression)
-#define NDN_LOG_FATAL(expression) NDN_LOG(FATAL, FATAL, FATAL, expression)
-
-} // namespace util
-} // namespace ndn
-
-#endif // NFD_ANDROID_NDN_CXX_ANDROID_NDN_CXX_CUSTOM_LOGGER_HPP
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logging.cpp b/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logging.cpp
deleted file mode 100644
index 845d412..0000000
--- a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logging.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "ndn-cxx-custom-logging.hpp"
-#include "ndn-cxx-custom-logger.hpp"
-
-#include <cstdlib>
-#include <sstream>
-
-namespace ndn {
-namespace util {
-
-static const LogLevel INITIAL_DEFAULT_LEVEL = LogLevel::NONE;
-
-Logging&
-Logging::get()
-{
- // Initialization of block-scope variables with static storage duration is thread-safe.
- // See ISO C++ standard [stmt.dcl]/4
- static Logging instance;
- return instance;
-}
-
-Logging::Logging()
-{
-}
-
-void
-Logging::addLoggerImpl(Logger& logger)
-{
- std::lock_guard<std::mutex> lock(m_mutex);
-
- const std::string& moduleName = logger.getModuleName();
- m_loggers.insert({moduleName, &logger});
-
- auto levelIt = m_enabledLevel.find(moduleName);
- if (levelIt == m_enabledLevel.end()) {
- levelIt = m_enabledLevel.find("*");
- }
- LogLevel level = levelIt == m_enabledLevel.end() ? INITIAL_DEFAULT_LEVEL : levelIt->second;
- logger.setLevel(level);
-}
-
-void
-Logging::setLevelImpl(const std::string& moduleName, LogLevel level)
-{
- std::lock_guard<std::mutex> lock(m_mutex);
-
- if (moduleName == "*") {
- this->setDefaultLevel(level);
- return;
- }
-
- m_enabledLevel[moduleName] = level;
- auto range = m_loggers.equal_range(moduleName);
- for (auto i = range.first; i != range.second; ++i) {
- i->second->setLevel(level);
- }
-}
-
-void
-Logging::setDefaultLevel(LogLevel level)
-{
- m_enabledLevel.clear();
- m_enabledLevel["*"] = level;
-
- for (auto i = m_loggers.begin(); i != m_loggers.end(); ++i) {
- i->second->setLevel(level);
- }
-}
-
-void
-Logging::setLevelImpl(const std::string& config)
-{
- std::stringstream ss(config);
- std::string configModule;
- while (std::getline(ss, configModule, ':')) {
- size_t ind = configModule.find('=');
- if (ind == std::string::npos) {
- BOOST_THROW_EXCEPTION(std::invalid_argument("malformed logging config: '=' is missing"));
- }
-
- std::string moduleName = configModule.substr(0, ind);
- LogLevel level = parseLogLevel(configModule.substr(ind+1));
-
- this->setLevelImpl(moduleName, level);
- }
-}
-
-} // namespace util
-} // namespace ndn
diff --git a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logging.hpp b/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logging.hpp
deleted file mode 100644
index b59b927..0000000
--- a/app/src/main/jni/ndn-cxx-android/ndn-cxx-custom-logging.hpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NFD_ANDROID_NDN_CXX_ANDROID_NDN_CXX_CUSTOM_LOGGING_HPP
-#define NFD_ANDROID_NDN_CXX_ANDROID_NDN_CXX_CUSTOM_LOGGING_HPP
-
-#include "common.hpp"
-
-#include <mutex>
-#include <unordered_map>
-
-namespace ndn {
-namespace util {
-
-enum class LogLevel;
-class Logger;
-
-/** \brief controls the logging facility
- *
- * \note Public static methods are thread safe.
- * Non-public methods are not guaranteed to be thread safe.
- */
-class Logging : noncopyable
-{
-public:
- /** \brief register a new logger
- * \note App should declare a new logger with \p NDN_LOG_INIT macro.
- */
- static void
- addLogger(Logger& logger);
-
- /** \brief set severity level
- * \param moduleName logger name, or "*" for default level
- * \param level minimum severity level
- *
- * Log messages are output only if its severity is greater than the set minimum severity level.
- * Initial default severity level is \p LogLevel::NONE which enables FATAL only.
- *
- * Changing the default level overwrites individual settings.
- */
- static void
- setLevel(const std::string& moduleName, LogLevel level);
-
- /** \brief set severity levels with a config string
- * \param config colon-separate key=value pairs
- * \throw std::invalid_argument config string is malformed
- *
- * \code
- * Logging::setSeverityLevels("*=INFO:Face=DEBUG:NfdController=WARN");
- * \endcode
- * is equivalent to
- * \code
- * Logging::setSeverityLevel("*", LogLevel::INFO);
- * Logging::setSeverityLevel("Face", LogLevel::DEBUG);
- * Logging::setSeverityLevel("NfdController", LogLevel::WARN);
- * \endcode
- */
- static void
- setLevel(const std::string& config);
-
-private:
- Logging();
-
- void
- addLoggerImpl(Logger& logger);
-
- void
- setLevelImpl(const std::string& moduleName, LogLevel level);
-
- void
- setDefaultLevel(LogLevel level);
-
- void
- setLevelImpl(const std::string& config);
-
-NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- static Logging&
- get();
-
-private:
- std::mutex m_mutex;
- std::unordered_map<std::string, LogLevel> m_enabledLevel; ///< moduleName => minimum level
- std::unordered_multimap<std::string, Logger*> m_loggers; ///< moduleName => logger
-};
-
-inline void
-Logging::addLogger(Logger& logger)
-{
- get().addLoggerImpl(logger);
-}
-
-inline void
-Logging::setLevel(const std::string& moduleName, LogLevel level)
-{
- get().setLevelImpl(moduleName, level);
-}
-
-inline void
-Logging::setLevel(const std::string& config)
-{
- get().setLevelImpl(config);
-}
-
-
-} // namespace util
-} // namespace ndn
-
-#endif // NFD_ANDROID_NDN_CXX_ANDROID_NDN_CXX_CUSTOM_LOGGING_HPP
diff --git a/app/src/main/jni/ndn-cxx-android/version.hpp b/app/src/main/jni/ndn-cxx-android/version.hpp
deleted file mode 100644
index 4ab8d5d..0000000
--- a/app/src/main/jni/ndn-cxx-android/version.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library 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 Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_VERSION_HPP
-#define NDN_VERSION_HPP
-
-namespace ndn {
-
-/** ndn-cxx version follows Semantic Versioning 2.0.0 specification
- * http://semver.org/
- */
-
-/** \brief ndn-cxx version represented as an integer
- *
- * MAJOR*1000000 + MINOR*1000 + PATCH
- */
-#define NDN_CXX_VERSION 6000
-
-/** \brief ndn-cxx version represented as a string
- *
- * MAJOR.MINOR.PATCH
- */
-#define NDN_CXX_VERSION_STRING "0.6.0"
-
-/** \brief ndn-cxx version string, including git commit information, if ndn-cxx is build from
- * specific git commit
- *
- * NDN_CXX_VERSION_BUILD_STRING is obtained using the following command (`ndn-cxx-` prefix is
- * afterwards removed):
- *
- * `git describe --match 'ndn-cxx-*'`
- *
- * When ndn-cxx is built not from git, NDN_CXX_VERSION_BUILD_STRING equals NDN_CXX_VERSION_STRING
- *
- * MAJOR.MINOR.PATCH(-release-candidate-tag)(-(number-of-commits-since-tag)-COMMIT-HASH)
- *
- * Example, 0.1.0-rc1-1-g5c86570
- */
-#define NDN_CXX_VERSION_BUILD_STRING "0.6.0"
-
-/// MAJOR version
-#define NDN_CXX_VERSION_MAJOR 0
-/// MINOR version
-#define NDN_CXX_VERSION_MINOR 6
-/// PATCH version
-#define NDN_CXX_VERSION_PATCH 0
-
-} // namespace ndn
-
-#endif // NDN_VERSION_HPP
diff --git a/app/src/main/jni/ndn-cxx.mk b/app/src/main/jni/ndn-cxx.mk
deleted file mode 100644
index d12a5b6..0000000
--- a/app/src/main/jni/ndn-cxx.mk
+++ /dev/null
@@ -1,173 +0,0 @@
-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 program_options chrono random
-LOCAL_SHARED_LIBRARIES := libcrypto_shared libssl_shared $(addsuffix _shared,$(addprefix boost_,$(NDN_CXX_BOOST_LIBS)))
-LOCAL_STATIC_LIBRARIES := sqlite3_static boost_regex_static
-NDN_CXX_SRC_FILES := \
- data.cpp \
- delegation-list.cpp \
- delegation.cpp \
- encoding/block-helpers.cpp \
- encoding/block.cpp \
- encoding/buffer-stream.cpp \
- encoding/buffer.cpp \
- encoding/encoder.cpp \
- encoding/estimator.cpp \
- encoding/nfd-constants.cpp \
- encoding/tlv.cpp \
- exclude.cpp \
- face.cpp \
- ims/in-memory-storage-entry.cpp \
- ims/in-memory-storage-fifo.cpp \
- ims/in-memory-storage-lfu.cpp \
- ims/in-memory-storage-lru.cpp \
- ims/in-memory-storage-persistent.cpp \
- ims/in-memory-storage.cpp \
- interest-filter.cpp \
- interest.cpp \
- key-locator.cpp \
- link.cpp \
- lp/cache-policy.cpp \
- lp/nack-header.cpp \
- lp/nack.cpp \
- lp/packet.cpp \
- meta-info.cpp \
- mgmt/control-response.cpp \
- mgmt/dispatcher.cpp \
- mgmt/nfd/channel-status.cpp \
- mgmt/nfd/command-options.cpp \
- mgmt/nfd/control-command.cpp \
- mgmt/nfd/control-parameters.cpp \
- mgmt/nfd/controller.cpp \
- mgmt/nfd/face-event-notification.cpp \
- mgmt/nfd/face-monitor.cpp \
- mgmt/nfd/face-query-filter.cpp \
- mgmt/nfd/face-status.cpp \
- mgmt/nfd/fib-entry.cpp \
- mgmt/nfd/forwarder-status.cpp \
- mgmt/nfd/rib-entry.cpp \
- mgmt/nfd/status-dataset.cpp \
- mgmt/nfd/strategy-choice.cpp \
- mgmt/status-dataset-context.cpp \
- name-component.cpp \
- name.cpp \
- net/address-converter.cpp \
- net/detail/link-type-helper.cpp \
- net/detail/linux-if-constants.cpp \
- net/detail/network-monitor-impl-rtnl.cpp \
- net/dns.cpp \
- net/ethernet.cpp \
- net/face-uri.cpp \
- net/network-address.cpp \
- net/network-interface.cpp \
- net/network-monitor-stub.cpp \
- net/network-monitor.cpp \
- packet-base.cpp \
- security/command-interest-signer.cpp \
- security/detail/openssl-helper.cpp \
- security/digest-sha256.cpp \
- security/key-params.cpp \
- security/pib/certificate-container.cpp \
- security/pib/detail/identity-impl.cpp \
- security/pib/detail/key-impl.cpp \
- security/pib/identity-container.cpp \
- security/pib/identity.cpp \
- security/pib/key-container.cpp \
- security/pib/key.cpp \
- security/pib/pib-memory.cpp \
- security/pib/pib-sqlite3.cpp \
- security/pib/pib.cpp \
- security/safe-bag.cpp \
- security/security-common.cpp \
- security/signature-sha256-with-ecdsa.cpp \
- security/signature-sha256-with-rsa.cpp \
- security/signing-helpers.cpp \
- security/signing-info.cpp \
- security/tpm/back-end-file.cpp \
- security/tpm/back-end-mem.cpp \
- security/tpm/back-end.cpp \
- security/tpm/key-handle-mem.cpp \
- security/tpm/key-handle.cpp \
- security/tpm/tpm.cpp \
- security/transform/base64-decode.cpp \
- security/transform/base64-encode.cpp \
- security/transform/block-cipher.cpp \
- security/transform/bool-sink.cpp \
- security/transform/buffer-source.cpp \
- security/transform/digest-filter.cpp \
- security/transform/hex-decode.cpp \
- security/transform/hex-encode.cpp \
- security/transform/hmac-filter.cpp \
- security/transform/private-key.cpp \
- security/transform/public-key.cpp \
- security/transform/signer-filter.cpp \
- security/transform/step-source.cpp \
- security/transform/stream-sink.cpp \
- security/transform/stream-source.cpp \
- security/transform/strip-space.cpp \
- security/transform/transform-base.cpp \
- security/transform/verifier-filter.cpp \
- security/v2/additional-description.cpp \
- security/v2/certificate-bundle-fetcher.cpp \
- security/v2/certificate-cache.cpp \
- security/v2/certificate-fetcher-direct-fetch.cpp \
- security/v2/certificate-fetcher-from-network.cpp \
- security/v2/certificate-fetcher-offline.cpp \
- security/v2/certificate-fetcher.cpp \
- security/v2/certificate-storage.cpp \
- security/v2/certificate.cpp \
- security/v2/key-chain.cpp \
- security/v2/trust-anchor-container.cpp \
- security/v2/trust-anchor-group.cpp \
- security/v2/validation-error.cpp \
- security/v2/validation-policy-command-interest.cpp \
- security/v2/validation-policy-config.cpp \
- security/v2/validation-policy-simple-hierarchy.cpp \
- security/v2/validation-policy.cpp \
- security/v2/validation-state.cpp \
- security/v2/validator-config/checker.cpp \
- security/v2/validator-config/filter.cpp \
- security/v2/validator-config/name-relation.cpp \
- security/v2/validator-config/rule.cpp \
- security/v2/validator.cpp \
- security/validator-config.cpp \
- security/validator-null.cpp \
- security/validity-period.cpp \
- security/verification-helpers.cpp \
- selectors.cpp \
- signature-info.cpp \
- signature.cpp \
- transport/tcp-transport.cpp \
- transport/transport.cpp \
- transport/unix-transport.cpp \
- util/config-file.cpp \
- util/dummy-client-face.cpp \
- util/indented-stream.cpp \
- util/io.cpp \
- util/notification-subscriber.cpp \
- util/random.cpp \
- util/regex/regex-top-matcher.cpp \
- util/scheduler-scoped-event-id.cpp \
- util/scheduler.cpp \
- util/segment-fetcher.cpp \
- util/sha256.cpp \
- util/signal/connection.cpp \
- util/signal/scoped-connection.cpp \
- util/sqlite3-statement.cpp \
- util/string-helper.cpp \
- util/time-unit-test-clock.cpp \
- util/time.cpp \
- ../../ndn-cxx-android/ndn-cxx-custom-logger.cpp \
- ../../ndn-cxx-android/ndn-cxx-custom-logging.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 -I$(LOCAL_PATH)/../../../build/generated/source/ndn-cxx
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ndn-cxx-android $(LOCAL_PATH)/../../../build/generated/source/include
-LOCAL_LDLIBS := -llog -latomic
-include $(BUILD_SHARED_LIBRARY)
-
-$(call import-module,../packages/boost/1.65.1)
-$(call import-module,../packages/sqlite/3.18.0)
-$(call import-module,../packages/openssl/1.0.2m)
diff --git a/app/src/main/jni/nfd-android/core/config.hpp b/app/src/main/jni/nfd-android/core/config.hpp
deleted file mode 100644
index 30c61c2..0000000
--- a/app/src/main/jni/nfd-android/core/config.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef W_CONFIG_HPP_WAF
-#define W_CONFIG_HPP_WAF
-
-#define HAVE_IS_DEFAULT_CONSTRUCTIBLE 1
-#define HAVE_IS_MOVE_CONSTRUCTIBLE 1
-#define HAVE_LIBRT
-#define HAVE_LIBRESOLV
-// #define HAVE_IFADDRS_H 1
-/*#undef HAVE_UNIX_SOCKETS*/
-#define HAVE_WEBSOCKET 1
-#define _WEBSOCKETPP_CPP11_STL_ 1
-#define DEFAULT_CONFIG_FILE "./nfd.conf"
-#define HAVE_CUSTOM_LOGGER 1
-#define NDEBUG 1
-
-#define BOOST_LOG_DYN_LINK 1
-
-#endif /* W_CONFIG_HPP_WAF */
diff --git a/app/src/main/jni/nfd-android/core/version.hpp b/app/src/main/jni/nfd-android/core/version.hpp
deleted file mode 100644
index 19a9d22..0000000
--- a/app/src/main/jni/nfd-android/core/version.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, 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_CORE_VERSION_HPP
-#define NFD_CORE_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 6000
-
-/** \brief NFD version represented as a string
- *
- * MAJOR.MINOR.PATCH
- */
-#define NFD_VERSION_STRING "0.6.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.6.0"
-
-/// MAJOR version
-#define NFD_VERSION_MAJOR 0
-/// MINOR version
-#define NFD_VERSION_MINOR 6
-/// PATCH version
-#define NFD_VERSION_PATCH 0
-
-} // namespace nfd
-
-#endif // NFD_CORE_VERSION_HPP
diff --git a/app/src/main/jni/nfd-android/custom-logger-factory.cpp b/app/src/main/jni/nfd-android/custom-logger-factory.cpp
deleted file mode 100644
index 436bdf1..0000000
--- a/app/src/main/jni/nfd-android/custom-logger-factory.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, 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 "custom-logger-factory.hpp"
-
-#include <boost/algorithm/string/case_conv.hpp>
-
-namespace nfd {
-
-NFD_LOG_INIT("LoggerFactory");
-
-LoggerFactory&
-LoggerFactory::getInstance()
-{
- static LoggerFactory globalLoggerFactory;
-
- return globalLoggerFactory;
-}
-
-LoggerFactory::LoggerFactory()
- : m_defaultLevel(LOG_INFO)
-{
- m_levelNames["NONE"] = LOG_NONE;
- m_levelNames["ERROR"] = LOG_ERROR;
- m_levelNames["WARN"] = LOG_WARN;
- m_levelNames["INFO"] = LOG_INFO;
- m_levelNames["DEBUG"] = LOG_DEBUG;
- m_levelNames["TRACE"] = LOG_TRACE;
- m_levelNames["ALL"] = LOG_ALL;
-}
-
-void
-LoggerFactory::setConfigFile(ConfigFile& config)
-{
- config.addSectionHandler("log", bind(&LoggerFactory::onConfig, this, _1, _2, _3));
-}
-
-LogLevel
-LoggerFactory::parseLevel(const std::string& level)
-{
- std::string upperLevel = level;
- boost::to_upper(upperLevel);
-
- // std::cerr << "parsing level: " << upperLevel << std::endl;;
- // std::cerr << "# levels: " << m_levelNames.size() << std::endl;
- // std::cerr << m_levelNames.begin()->first << std::endl;
-
- LevelMap::const_iterator levelIt = m_levelNames.find(upperLevel);
- if (levelIt != m_levelNames.end()) {
- return levelIt->second;
- }
- try {
- uint32_t levelNo = boost::lexical_cast<uint32_t>(level);
-
- if ((boost::lexical_cast<uint32_t>(LOG_NONE) <= levelNo &&
- levelNo <= boost::lexical_cast<uint32_t>(LOG_TRACE)) ||
- levelNo == LOG_ALL) {
- return static_cast<LogLevel>(levelNo);
- }
- }
- catch (const boost::bad_lexical_cast& error) {
- }
- throw LoggerFactory::Error("Unsupported logging level \"" + level + "\"");
-}
-
-LogLevel
-LoggerFactory::extractLevel(const ConfigSection& item, const std::string& key)
-{
- std::string levelString;
- try {
- levelString = item.get_value<std::string>();
- }
- catch (const boost::property_tree::ptree_error& error) {
- }
-
- if (levelString.empty()) {
- throw LoggerFactory::Error("No logging level found for option \"" + key + "\"");
- }
-
- return parseLevel(levelString);
-}
-
-void
-LoggerFactory::onConfig(const ConfigSection& section,
- bool isDryRun,
- const std::string& filename)
-{
-// log
-// {
-// ; default_level specifies the logging level for modules
-// ; that are not explicitly named. All debugging levels
-// ; listed above the selected value are enabled.
-//
-// default_level INFO
-//
-// ; You may also override the default for specific modules:
-//
-// FibManager DEBUG
-// Forwarder WARN
-// }
-
- if (!isDryRun) {
- ConfigSection::const_assoc_iterator item = section.find("default_level");
- if (item != section.not_found()) {
- LogLevel level = extractLevel(item->second, "default_level");
- setDefaultLevel(level);
- }
- else {
- setDefaultLevel(LOG_INFO);
- }
- }
-
- for (ConfigSection::const_iterator item = section.begin();
- item != section.end();
- ++item) {
- LogLevel level = extractLevel(item->second, item->first);
-
- if (item->first == "default_level") {
- // do nothing
- }
- else {
- LoggerMap::iterator loggerIt = m_loggers.find(item->first);
- if (loggerIt == m_loggers.end()) {
- NFD_LOG_DEBUG("Failed to configure logging level for module \"" <<
- item->first << "\" (module not found)");
- }
- else if (!isDryRun) {
- // std::cerr << "changing level for module " << item->first << " to " << level << std::endl;
- loggerIt->second.setLogLevel(level);
- }
- }
- }
-}
-
-void
-LoggerFactory::setDefaultLevel(LogLevel level)
-{
- // std::cerr << "changing to default_level " << level << std::endl;
-
- m_defaultLevel = level;
- for (LoggerMap::iterator i = m_loggers.begin(); i != m_loggers.end(); ++i) {
- // std::cerr << "changing " << i->first << " to default " << m_defaultLevel << std::endl;
- i->second.setLogLevel(m_defaultLevel);
- }
-}
-
-Logger&
-LoggerFactory::create(const std::string& moduleName)
-{
- return LoggerFactory::getInstance().createLogger(moduleName);
-}
-
-Logger&
-LoggerFactory::createLogger(const std::string& moduleName)
-{
- // std::cerr << "creating logger for " << moduleName
- // << " with level " << m_defaultLevel << std::endl;
-
- std::pair<LoggerMap::iterator, bool> loggerIt =
- m_loggers.insert(NameAndLogger(moduleName, Logger(moduleName, m_defaultLevel)));
-
- return loggerIt.first->second;
-}
-
-std::list<std::string>
-LoggerFactory::getModules() const
-{
- std::list<std::string> modules;
- for (LoggerMap::const_iterator i = m_loggers.begin(); i != m_loggers.end(); ++i) {
- modules.push_back(i->first);
- }
-
- return modules;
-}
-
-} // namespace nfd
diff --git a/app/src/main/jni/nfd-android/custom-logger-factory.hpp b/app/src/main/jni/nfd-android/custom-logger-factory.hpp
deleted file mode 100644
index f158b81..0000000
--- a/app/src/main/jni/nfd-android/custom-logger-factory.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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_ANDROID_CUSTOM_LOGGER_FACTORY_HPP
-#define NFD_ANDROID_CUSTOM_LOGGER_FACTORY_HPP
-
-#include "core/common.hpp"
-
-#include "core/config-file.hpp"
-#include "core/logger.hpp"
-
-namespace nfd {
-
-class LoggerFactory : noncopyable
-{
-public:
-
- class Error : public std::runtime_error
- {
- public:
- explicit
- Error(const std::string& error)
- : std::runtime_error(error)
- {
- }
- };
-
- static LoggerFactory&
- getInstance();
-
- void
- setConfigFile(ConfigFile& config);
-
- void
- onConfig(const ConfigSection& section, bool isDryRun, const std::string& filename);
-
- std::list<std::string>
- getModules() const;
-
- static Logger&
- create(const std::string& moduleName);
-
-
-PUBLIC_WITH_TESTS_ELSE_PRIVATE:
-
- // these methods are used during unit-testing
-
- LogLevel
- getDefaultLevel() const;
-
- void
- setDefaultLevel(LogLevel level);
-
-private:
-
- LoggerFactory();
-
- Logger&
- createLogger(const std::string& moduleName);
-
- LogLevel
- parseLevel(const std::string& level);
-
- LogLevel
- extractLevel(const ConfigSection& item, const std::string& key);
-
-private:
-
- typedef std::map<std::string, LogLevel> LevelMap;
- typedef std::pair<std::string, LogLevel> NameAndLevel;
-
- LevelMap m_levelNames;
-
- typedef std::map<std::string, Logger> LoggerMap;
- typedef std::pair<std::string, Logger> NameAndLogger;
-
- LoggerMap m_loggers;
-
- LogLevel m_defaultLevel;
-};
-
-inline LogLevel
-LoggerFactory::getDefaultLevel() const
-{
- return m_defaultLevel;
-}
-
-} // namespace nfd
-
-#endif // NFD_ANDROID_CUSTOM_LOGGER_FACTORY_HPP
diff --git a/app/src/main/jni/nfd-android/custom-logger.cpp b/app/src/main/jni/nfd-android/custom-logger.cpp
deleted file mode 100644
index d5e7ca1..0000000
--- a/app/src/main/jni/nfd-android/custom-logger.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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 "custom-logger.hpp"
-
-namespace nfd {
-
-Logger::Logger(const std::string& name, LogLevel level)
- : m_moduleName(name)
- , m_enabledLogLevel(level)
-{
-}
-
-} // namespace nfd
diff --git a/app/src/main/jni/nfd-android/custom-logger.hpp b/app/src/main/jni/nfd-android/custom-logger.hpp
deleted file mode 100644
index 86ed64c..0000000
--- a/app/src/main/jni/nfd-android/custom-logger.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, 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_ANDROID_CUSTOM_LOGGER_HPP
-#define NFD_ANDROID_CUSTOM_LOGGER_HPP
-
-#include "core/common.hpp"
-#include <sstream>
-#include <android/log.h>
-
-namespace nfd {
-
-/** \brief indicates a log level
- * \note This type is internal. Logger should be accessed through NFD_LOG_* macros.
- */
-enum LogLevel {
- LOG_FATAL = -1, // fatal (will be logged unconditionally)
- LOG_NONE = 0, // no messages
- LOG_ERROR = 1, // serious error messages
- LOG_WARN = 2, // warning messages
- LOG_INFO = 3, // informational messages
- LOG_DEBUG = 4, // debug messages
- LOG_TRACE = 5, // trace messages (most verbose)
- LOG_ALL = 255 // all messages
-};
-
-/** \brief provides logging for a module
- * \note This type is internal. Logger should be accessed through NFD_LOG_* macros.
- * \note This type is copyable because logger can be declared as a field of
- * (usually template) classes, and shouldn't prevent those classes to be copyable.
- */
-class Logger
-{
-public:
- Logger(const std::string& name, LogLevel level);
-
- bool
- isEnabled(LogLevel level) const
- {
- return m_enabledLogLevel >= level;
- }
-
- void
- setLogLevel(LogLevel level)
- {
- m_enabledLogLevel = level;
- }
-
- const std::string&
- getName() const
- {
- return m_moduleName;
- }
-
- void
- setName(const std::string& name)
- {
- m_moduleName = name;
- }
-
-private:
- std::string m_moduleName;
- LogLevel m_enabledLogLevel;
-};
-
-inline std::ostream&
-operator<<(std::ostream& output, const Logger& logger)
-{
- output << logger.getName();
- return output;
-}
-
-} // namespace nfd
-
-#include "core/logger-factory.hpp"
-
-namespace nfd {
-
-#define NFD_LOG_INIT(name) \
-static nfd::Logger& g_logger = nfd::LoggerFactory::create(name)
-
-#define NFD_LOG_INCLASS_DECLARE() \
-static nfd::Logger& g_logger
-
-#define NFD_LOG_INCLASS_DEFINE(cls, name) \
-nfd::Logger& cls::g_logger = nfd::LoggerFactory::create(name)
-
-#define NFD_LOG_INCLASS_TEMPLATE_DEFINE(cls, name) \
-template<class T> \
-nfd::Logger& cls<T>::g_logger = nfd::LoggerFactory::create(name)
-
-#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name) \
-template<> \
-nfd::Logger& cls<specialization>::g_logger = nfd::LoggerFactory::create(name)
-
-#define NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(cls, s1, s2, name) \
-template<> \
-nfd::Logger& cls<s1, s2>::g_logger = nfd::LoggerFactory::create(name)
-
-#define NFD_LOG(nfdLevel, androidLevel, msg, expression) \
-do { \
- if (g_logger.isEnabled(::nfd::LOG_##nfdLevel)) { \
- std::ostringstream os; \
- os << expression; \
- __android_log_print(ANDROID_LOG_##androidLevel, \
- g_logger.getName().c_str(), "%s", os.str().c_str()); \
- } \
-} while (false)
-
-#define NFD_LOG_TRACE(expression) NFD_LOG(TRACE, VERBOSE, TRACE, expression)
-#define NFD_LOG_DEBUG(expression) NFD_LOG(DEBUG, DEBUG, DEBUG, expression)
-#define NFD_LOG_INFO(expression) NFD_LOG(INFO, INFO, INFO, expression)
-#define NFD_LOG_WARN(expression) NFD_LOG(WARN, WARN, WARNING, expression)
-#define NFD_LOG_ERROR(expression) NFD_LOG(ERROR, ERROR, ERROR, expression)
-#define NFD_LOG_FATAL(expression) NFD_LOG(FATAL, FATAL, FATAL, expression)
-
-} // namespace nfd
-
-#endif // NFD_ANDROID_CUSTOM_LOGGER_HPP
diff --git a/app/src/main/jni/nfd-wrapper.cpp b/app/src/main/jni/nfd-wrapper.cpp
index a04585e..918efce 100644
--- a/app/src/main/jni/nfd-wrapper.cpp
+++ b/app/src/main/jni/nfd-wrapper.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2015-2016 Regents of the University of California
+ * Copyright (c) 2015-2018 Regents of the University of California
*
* This file is part of NFD (Named Data Networking Forwarding Daemon) Android.
* See AUTHORS.md for complete list of NFD Android authors and contributors.
@@ -22,17 +22,18 @@
#include "daemon/nfd.hpp"
#include "rib/service.hpp"
-#include "core/global-io.hpp"
#include "core/config-file.hpp"
+#include "core/global-io.hpp"
#include "core/logger.hpp"
#include "core/privilege-helper.hpp"
-#include <stdlib.h>
#include <boost/property_tree/info_parser.hpp>
#include <boost/thread.hpp>
#include <mutex>
+#include <ndn-cxx/util/logging.hpp>
+#include <stdlib.h>
-NFD_LOG_INIT("NfdWrapper");
+NFD_LOG_INIT(NfdWrapper);
namespace nfd {
@@ -48,104 +49,67 @@
void
resetGlobalIoService();
-
class Runner
{
public:
Runner()
: m_io(nullptr)
{
- std::string initialConfig =
- "general\n"
- "{\n"
- "}\n"
- "\n"
- "log\n"
- "{\n"
- " default_level ALL\n"
- " NameTree INFO\n"
- " BestRouteStrategy2 INFO\n"
- " InternalFace INFO\n"
- " Forwarder INFO\n"
- " ContentStore INFO\n"
- " DeadNonceList INFO\n"
- "}\n"
- "tables\n"
- "{\n"
- " cs_max_packets 100\n"
- "\n"
- " strategy_choice\n"
- " {\n"
- " / /localhost/nfd/strategy/best-route\n"
- " /localhost /localhost/nfd/strategy/multicast\n"
- " /localhost/nfd /localhost/nfd/strategy/best-route\n"
- " /ndn/broadcast /localhost/nfd/strategy/multicast\n"
- " /ndn/multicast /localhost/nfd/strategy/multicast\n"
- " }\n"
- "}\n"
- "\n"
- "face_system\n"
- "{\n"
- " tcp\n"
- " {\n"
- " listen yes\n"
- " port 6363\n"
- " enable_v4 yes\n"
- " enable_v6 yes\n"
- " }\n"
- "\n"
- " udp\n"
- " {\n"
- " port 6363\n"
- " enable_v4 yes\n"
- " enable_v6 yes\n"
- " idle_timeout 600\n"
- " keep_alive_interval 25\n"
- " mcast no\n"
- " }\n"
- " websocket\n"
- " {\n"
- " listen yes\n"
- " port 9696\n"
- " enable_v4 yes\n"
- " enable_v6 yes\n"
- " }\n"
- "}\n"
- "\n"
- "authorizations\n"
- "{\n"
- " authorize\n"
- " {\n"
- " certfile any\n"
- " privileges\n"
- " {\n"
- " faces\n"
- " fib\n"
- " strategy-choice\n"
- " }\n"
- " }\n"
- "}\n"
- "\n"
- "rib\n"
- "{\n"
- " localhost_security\n"
- " {\n"
- " trust-anchor\n"
- " {\n"
- " type any\n"
- " }\n"
- " }\n"
- "\n"
- " auto_prefix_propagate\n"
- " {\n"
- " cost 15\n"
- " timeout 10000\n"
- " refresh_interval 300\n"
- " base_retry_wait 50\n"
- " max_retry_wait 3600\n"
- " }\n"
- "}\n"
- "\n";
+ std::string initialConfig = R"CONF(
+ log
+ {
+ default_level ALL
+ }
+ tables
+ {
+ cs_max_packets 100
+ strategy_choice
+ {
+ / /localhost/nfd/strategy/best-route
+ /localhost /localhost/nfd/strategy/multicast
+ /localhost/nfd /localhost/nfd/strategy/best-route
+ /ndn/broadcast /localhost/nfd/strategy/multicast
+ /ndn/multicast /localhost/nfd/strategy/multicast
+ }
+ }
+ face_system
+ {
+ tcp
+ udp
+ {
+ mcast no
+ }
+ websocket
+ }
+ authorizations
+ {
+ authorize
+ {
+ certfile any
+ privileges
+ {
+ faces
+ fib
+ cs
+ strategy-choice
+ }
+ }
+ }
+ rib
+ {
+ localhost_security
+ {
+ trust-anchor
+ {
+ type any
+ }
+ }
+ auto_prefix_propagate
+ {
+ refresh_interval 300
+ }
+ }
+ )CONF";
std::istringstream input(initialConfig);
boost::property_tree::read_info(input, m_config);
@@ -308,7 +272,7 @@
jobject jModules = env->NewObject(jcLinkedList, jcLinkedListConstructor);
- for (const auto& module : nfd::LoggerFactory::getInstance().getModules()) {
+ for (const auto& module : ndn::util::Logging::getLoggerNames()) {
jstring jModule = env->NewStringUTF(module.c_str());
env->CallBooleanMethod(jModules, jcLinkedListAdd, jModule);
}
diff --git a/app/src/main/jni/nfd.mk b/app/src/main/jni/nfd.mk
deleted file mode 100644
index a2c145e..0000000
--- a/app/src/main/jni/nfd.mk
+++ /dev/null
@@ -1,131 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-LOCAL_PATH_SAVED := $(LOCAL_PATH)
-
-NFD_BOOST_LIBS = system filesystem chrono program_options random thread
-
-# nfd itself
-include $(CLEAR_VARS)
-LOCAL_MODULE := nfd-daemon
-LOCAL_SHARED_LIBRARIES := libssl_shared libcrypto_shared ndn-cxx $(addsuffix _shared,$(addprefix boost_,$(NFD_BOOST_LIBS)))
-NFD_DAEMON_SRC_FILES := \
- core/city-hash.cpp \
- core/config-file.cpp \
- core/global-io.cpp \
- core/manager-base.cpp \
- core/network-interface-predicate.cpp \
- core/network.cpp \
- core/privilege-helper.cpp \
- core/random.cpp \
- core/rtt-estimator.cpp \
- core/scheduler.cpp \
- ../nfd-android/custom-logger.cpp \
- ../nfd-android/custom-logger-factory.cpp \
- \
- daemon/face/channel.cpp \
- daemon/face/face-counters.cpp \
- daemon/face/face-system.cpp \
- daemon/face/face.cpp \
- daemon/face/generic-link-service.cpp \
- daemon/face/internal-face.cpp \
- daemon/face/internal-transport.cpp \
- daemon/face/link-service.cpp \
- daemon/face/lp-fragmenter.cpp \
- daemon/face/lp-reassembler.cpp \
- daemon/face/lp-reliability.cpp \
- daemon/face/multicast-udp-transport.cpp \
- daemon/face/null-face.cpp \
- daemon/face/protocol-factory.cpp \
- daemon/face/tcp-channel.cpp \
- daemon/face/tcp-factory.cpp \
- daemon/face/tcp-transport.cpp \
- daemon/face/transport.cpp \
- daemon/face/udp-channel.cpp \
- daemon/face/udp-factory.cpp \
- daemon/face/udp-protocol.cpp \
- daemon/face/unicast-udp-transport.cpp \
- daemon/face/websocket-channel.cpp \
- daemon/face/websocket-factory.cpp \
- daemon/face/websocket-transport.cpp \
- daemon/fw/access-strategy.cpp \
- daemon/fw/algorithm.cpp \
- daemon/fw/asf-measurements.cpp \
- daemon/fw/asf-probing-module.cpp \
- daemon/fw/asf-strategy.cpp \
- daemon/fw/best-route-strategy.cpp \
- daemon/fw/best-route-strategy2.cpp \
- daemon/fw/client-control-strategy.cpp \
- daemon/fw/face-table.cpp \
- daemon/fw/forwarder.cpp \
- daemon/fw/multicast-strategy.cpp \
- daemon/fw/ncc-strategy.cpp \
- daemon/fw/process-nack-traits.cpp \
- daemon/fw/retx-suppression-exponential.cpp \
- daemon/fw/retx-suppression-fixed.cpp \
- daemon/fw/strategy.cpp \
- daemon/fw/unsolicited-data-policy.cpp \
- daemon/main.cpp \
- daemon/mgmt/command-authenticator.cpp \
- daemon/mgmt/face-manager.cpp \
- daemon/mgmt/fib-manager.cpp \
- daemon/mgmt/forwarder-status-manager.cpp \
- daemon/mgmt/general-config-section.cpp \
- daemon/mgmt/nfd-manager-base.cpp \
- daemon/mgmt/strategy-choice-manager.cpp \
- daemon/mgmt/tables-config-section.cpp \
- daemon/nfd.cpp \
- daemon/table/cleanup.cpp \
- daemon/table/cs-entry-impl.cpp \
- daemon/table/cs-entry.cpp \
- daemon/table/cs-policy-lru.cpp \
- daemon/table/cs-policy-priority-fifo.cpp \
- daemon/table/cs-policy.cpp \
- daemon/table/cs.cpp \
- daemon/table/dead-nonce-list.cpp \
- daemon/table/fib-entry.cpp \
- daemon/table/fib-nexthop.cpp \
- daemon/table/fib.cpp \
- daemon/table/measurements-accessor.cpp \
- daemon/table/measurements-entry.cpp \
- daemon/table/measurements.cpp \
- daemon/table/name-tree-entry.cpp \
- daemon/table/name-tree-hashtable.cpp \
- daemon/table/name-tree-iterator.cpp \
- daemon/table/name-tree.cpp \
- daemon/table/network-region-table.cpp \
- daemon/table/pit-entry.cpp \
- daemon/table/pit-face-record.cpp \
- daemon/table/pit-in-record.cpp \
- daemon/table/pit-iterator.cpp \
- daemon/table/pit-out-record.cpp \
- daemon/table/pit.cpp \
- daemon/table/strategy-choice-entry.cpp \
- daemon/table/strategy-choice.cpp \
- daemon/table/strategy-info-host.cpp \
- \
- rib/auto-prefix-propagator.cpp \
- rib/fib-update.cpp \
- rib/fib-updater.cpp \
- rib/propagated-entry.cpp \
- rib/readvertise/client-to-nlsr-readvertise-policy.cpp \
- rib/readvertise/nfd-rib-readvertise-destination.cpp \
- rib/readvertise/readvertise-destination.cpp \
- rib/readvertise/readvertise.cpp \
- rib/readvertise/readvertised-route.cpp \
- rib/rib-entry.cpp \
- rib/rib-manager.cpp \
- rib/rib-update-batch.cpp \
- rib/rib-update.cpp \
- rib/rib.cpp \
- rib/route.cpp \
- rib/service.cpp
-LOCAL_SRC_FILES := $(addprefix NFD/,$(NFD_DAEMON_SRC_FILES))
-LOCAL_CPPFLAGS := \
- -I$(LOCAL_PATH)/nfd-android \
- -I$(LOCAL_PATH)/NFD \
- -I$(LOCAL_PATH)/NFD/core \
- -I$(LOCAL_PATH)/NFD/daemon \
- -I$(LOCAL_PATH)/NFD/rib \
- -I$(LOCAL_PATH)/NFD/websocketpp
-LOCAL_LDLIBS := -llog
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/nfd-android $(LOCAL_PATH)/NFD
-include $(BUILD_SHARED_LIBRARY)
diff --git a/build.gradle b/build.gradle
index cd98715..3904604 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,7 +9,7 @@
}
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.1'
+ classpath 'com.android.tools.build:gradle:3.1.3'
// classpath 'net.named-data.playground:play-publisher:1.2.0-2-SNAPSHOT'
classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 6b55714..b249a5c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip