jni: Upgrade NFD/ndn-cxx to version 0.6.5
Change-Id: If390a5bd4df99e36d84c04d6c93c720d7b184d73
diff --git a/app/src/main/java/net/named_data/nfd/PingClient.java b/app/src/main/java/net/named_data/nfd/PingClient.java
index 70abdfc..bdeb046 100644
--- a/app/src/main/java/net/named_data/nfd/PingClient.java
+++ b/app/src/main/java/net/named_data/nfd/PingClient.java
@@ -1,6 +1,6 @@
/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2015-2016 Regents of the University of California
+ * Copyright (c) 2015-2019 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.
@@ -187,7 +187,12 @@
private void processEvents() {
try {
if (m_isRunning.get()) {
- m_face.processEvents();
+ try {
+ m_face.processEvents();
+ }
+ catch (EncodingException e) {
+ G.Log("Encoding error: " + e.getMessage());
+ }
m_handler.postDelayed(new Runnable() {
@Override
public void run()
@@ -203,9 +208,6 @@
catch (IOException e) {
G.Log("Face error: " + e.getMessage());
}
- catch (EncodingException e) {
- G.Log("Encoding error: " + e.getMessage());
- }
}
private void terminate() {
diff --git a/app/src/main/java/net/named_data/nfd/service/NfdService.java b/app/src/main/java/net/named_data/nfd/service/NfdService.java
index 5b85a6e..92196f6 100644
--- a/app/src/main/java/net/named_data/nfd/service/NfdService.java
+++ b/app/src/main/java/net/named_data/nfd/service/NfdService.java
@@ -1,6 +1,6 @@
/* -*- Mode:jde; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2015-2018 Regents of the University of California
+ * Copyright (c) 2015-2019 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.
@@ -114,9 +114,6 @@
public native static boolean
isNfdRunning();
- public native static List<String>
- getNfdLogModules();
-
/**
* Message to start NFD Service
*/
@@ -216,12 +213,6 @@
startNfd(params);
- // Example how to retrieve all available NFD log modules
- List<String> modules = getNfdLogModules();
- for (String module : modules) {
- G.Log(module);
- }
-
// TODO: Reload NFD and NRD in memory structures (if any)
// Keep Service alive; In event when service is started
diff --git a/app/src/main/jni/Android.mk b/app/src/main/jni/Android.mk
index 9310d31..6b99cba 100644
--- a/app/src/main/jni/Android.mk
+++ b/app/src/main/jni/Android.mk
@@ -9,4 +9,4 @@
LOCAL_CFLAGS := -DBOOST_LOG_DYN_LINK=1
include $(BUILD_SHARED_LIBRARY)
-$(call import-module,../packages/nfd/0.6.2-11-gd657d53)
+$(call import-module,../packages/nfd/0.6.5)
diff --git a/app/src/main/jni/nfd-wrapper.cpp b/app/src/main/jni/nfd-wrapper.cpp
index 918efce..64c16f1 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-2018 Regents of the University of California
+ * Copyright (c) 2015-2019 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.
@@ -70,6 +70,7 @@
/localhost/nfd /localhost/nfd/strategy/best-route
/ndn/broadcast /localhost/nfd/strategy/multicast
/ndn/multicast /localhost/nfd/strategy/multicast
+ /sl /localhost/nfd/strategy/self-learning
}
}
face_system
@@ -104,40 +105,47 @@
type any
}
}
+ ; localhop_security
+ ; {
+ ; trust-anchor
+ ; {
+ ; type any
+ ; }
+ ; }
auto_prefix_propagate
{
refresh_interval 300
}
}
- )CONF";
+ )CONF";
std::istringstream input(initialConfig);
boost::property_tree::read_info(input, m_config);
- std::unique_lock<std::mutex> lock(m_pointerMutex);
m_nfd.reset(new Nfd(m_config, m_keyChain));
- m_nrd.reset(new rib::Service(m_config, m_keyChain));
+ m_ribService.reset(new rib::Service(m_config, m_keyChain));
m_nfd->initialize();
- m_nrd->initialize();
- }
-
- ~Runner()
- {
- stop();
- m_io->reset();
}
void
- start()
+ run()
{
{
std::unique_lock<std::mutex> lock(m_pointerMutex);
m_io = &getGlobalIoService();
}
+ setMainIoService(m_io);
+ setRibIoService(m_io);
+
m_io->run();
m_io->reset();
+
+ m_ribService.reset();
+ m_nfd.reset();
+
+ m_io = nullptr;
}
void
@@ -145,19 +153,17 @@
{
std::unique_lock<std::mutex> lock(m_pointerMutex);
- m_io->post([this] {
- m_io->stop();
- this->m_nrd.reset();
- this->m_nfd.reset();
- });
+ if (m_io != nullptr) {
+ m_io->stop();
+ }
}
private:
std::mutex m_pointerMutex;
boost::asio::io_service* m_io;
ndn::KeyChain m_keyChain;
- unique_ptr<Nfd> m_nfd; // will use globalIoService
- unique_ptr<rib::Service> m_nrd; // will use globalIoService
+ unique_ptr<Nfd> m_nfd;
+ unique_ptr<rib::Service> m_ribService;
nfd::ConfigSection m_config;
};
@@ -227,7 +233,7 @@
NFD_LOG_INFO("Starting NFD...");
try {
nfd::g_runner.reset(new nfd::Runner());
- nfd::g_runner->start();
+ nfd::g_runner->run();
}
catch (const std::exception& e) {
NFD_LOG_FATAL(e.what());
@@ -260,22 +266,5 @@
JNIEXPORT jboolean JNICALL
Java_net_named_1data_nfd_service_NfdService_isNfdRunning(JNIEnv*, jclass)
{
- return nfd::g_runner.get() != nullptr;
-}
-
-JNIEXPORT jobject JNICALL
-Java_net_named_1data_nfd_service_NfdService_getNfdLogModules(JNIEnv* env, jclass)
-{
- jclass jcLinkedList = env->FindClass("java/util/LinkedList");
- jmethodID jcLinkedListConstructor = env->GetMethodID(jcLinkedList, "<init>", "()V");
- jmethodID jcLinkedListAdd = env->GetMethodID(jcLinkedList, "add", "(Ljava/lang/Object;)Z");
-
- jobject jModules = env->NewObject(jcLinkedList, jcLinkedListConstructor);
-
- for (const auto& module : ndn::util::Logging::getLoggerNames()) {
- jstring jModule = env->NewStringUTF(module.c_str());
- env->CallBooleanMethod(jModules, jcLinkedListAdd, jModule);
- }
-
- return jModules;
+ return nfd::g_runner.get() != nullptr;
}
diff --git a/app/src/main/jni/nfd-wrapper.hpp b/app/src/main/jni/nfd-wrapper.hpp
index 69a0ab5..c3e11dc 100644
--- a/app/src/main/jni/nfd-wrapper.hpp
+++ b/app/src/main/jni/nfd-wrapper.hpp
@@ -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-2019 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.
@@ -51,14 +51,6 @@
JNIEXPORT jboolean JNICALL
Java_net_named_1data_nfd_service_NfdService_isNfdRunning(JNIEnv*, jclass);
-/*
- * Class: net_named_data_nfd_service_NfdService
- * Method: getNfdLogModules
- * Signature: ()Ljava/util/List;
- */
-JNIEXPORT jobject JNICALL
-Java_net_named_1data_nfd_service_NfdService_getNfdLogModules(JNIEnv*, jclass);
-
#ifdef __cplusplus
}
#endif