aboutsummaryrefslogtreecommitdiffstats
path: root/MetisForwarder/app
diff options
context:
space:
mode:
Diffstat (limited to 'MetisForwarder/app')
-rw-r--r--MetisForwarder/app/.gitignore1
-rw-r--r--MetisForwarder/app/CMakeLists.txt76
-rw-r--r--MetisForwarder/app/build.gradle65
-rw-r--r--MetisForwarder/app/cmake/Modules/FindCCNX_Common.cmake39
-rw-r--r--MetisForwarder/app/cmake/Modules/FindCCNX_Portal.cmake40
-rw-r--r--MetisForwarder/app/cmake/Modules/FindCCNX_Transport_Rta.cmake50
-rw-r--r--MetisForwarder/app/cmake/Modules/FindLibEvent.cmake47
-rw-r--r--MetisForwarder/app/cmake/Modules/FindLibicnet.cmake39
-rw-r--r--MetisForwarder/app/cmake/Modules/FindLibparc.cmake39
-rw-r--r--MetisForwarder/app/cmake/Modules/FindLongBow.cmake44
-rw-r--r--MetisForwarder/app/cmake/Modules/FindMetis.cmake41
-rw-r--r--MetisForwarder/app/cmake/Modules/FindUncrustify.cmake8
-rw-r--r--MetisForwarder/app/cmake/Modules/detectCacheSize.cmake21
-rw-r--r--MetisForwarder/app/cmake/Modules/version.cmake15
-rwxr-xr-xMetisForwarder/app/cmake/get_version.sh20
-rw-r--r--MetisForwarder/app/metisforwarder.keystorebin0 -> 2246 bytes
-rw-r--r--MetisForwarder/app/proguard-rules.pro25
-rw-r--r--MetisForwarder/app/src/androidTest/java/com/metis/ccnx/metisforwarder/ExampleInstrumentedTest.java35
-rw-r--r--MetisForwarder/app/src/main/AndroidManifest.xml32
-rw-r--r--MetisForwarder/app/src/main/c/metisForwarderWrap.c70
-rw-r--r--MetisForwarder/app/src/main/java/com/metis/ccnx/metisforwarder/MetisForwarderActivity.java233
-rw-r--r--MetisForwarder/app/src/main/java/com/metis/ccnx/service/MetisForwarderService.java145
-rw-r--r--MetisForwarder/app/src/main/java/com/metis/ccnx/supportlibrary/MetisForwarder.java42
-rw-r--r--MetisForwarder/app/src/main/java/com/metis/ccnx/utility/Constants.java34
-rw-r--r--MetisForwarder/app/src/main/java/com/metis/ccnx/utility/ResourcesEnumerator.java35
-rw-r--r--MetisForwarder/app/src/main/res/drawable/border.xml21
-rw-r--r--MetisForwarder/app/src/main/res/layout/activity_metis_forwarder.xml239
-rw-r--r--MetisForwarder/app/src/main/res/layout/spinner_layout.xml8
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 3418 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher_round.pngbin0 -> 4208 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2206 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher_round.pngbin0 -> 2555 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4842 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngbin0 -> 6114 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 7718 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngbin0 -> 10056 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin0 -> 10486 bytes
-rw-r--r--MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngbin0 -> 14696 bytes
-rw-r--r--MetisForwarder/app/src/main/res/values/colors.xml6
-rw-r--r--MetisForwarder/app/src/main/res/values/strings.xml3
-rw-r--r--MetisForwarder/app/src/main/res/values/styles.xml11
-rw-r--r--MetisForwarder/app/src/test/java/com/metis/ccnx/metisforwarder/ExampleUnitTest.java26
42 files changed, 1510 insertions, 0 deletions
diff --git a/MetisForwarder/app/.gitignore b/MetisForwarder/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/MetisForwarder/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/MetisForwarder/app/CMakeLists.txt b/MetisForwarder/app/CMakeLists.txt
new file mode 100644
index 00000000..3c794a8a
--- /dev/null
+++ b/MetisForwarder/app/CMakeLists.txt
@@ -0,0 +1,76 @@
+# For more information about using CMake with Android Studio, read the
+# documentation: https://d.android.com/studio/projects/add-native-code.html
+
+# Sets the minimum version of CMake required to build the native library.
+
+cmake_minimum_required(VERSION 3.4.1)
+
+# Creates and names a library, sets it as either STATIC
+# or SHARED, and provides the relative paths to its source code.
+# You can define multiple libraries, and CMake builds them for you.
+# Gradle automatically packages shared libraries with your APK.
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+set(CMAKE_FIND_ROOT_PATH "$ENV{CCNX_HOME};${CMAKE_FIND_ROOT_PATH}")
+include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/metis-forwarder)
+
+include_directories($ENV{CCNX_DEPENDENCIES}/include)
+set(OPENSSL_ROOT_DIR $ENV{CCNX_DEPENDENCIES})
+
+find_package( LongBow REQUIRED )
+include_directories(${LONGBOW_INCLUDE_DIRS})
+
+find_package( LibEvent REQUIRED )
+include_directories(${LIBEVENT_INCLUDE_DIRS})
+
+find_package( Libparc REQUIRED )
+include_directories(${LIBPARC_INCLUDE_DIRS})
+
+find_package( CCNX_Common REQUIRED )
+include_directories(${CCNX_COMMON_INCLUDE_DIRS})
+
+find_package( CCNX_Transport_Rta REQUIRED )
+include_directories(${CCNX_TRANSPORT_RTA_INCLUDE_DIRS})
+
+find_package( CCNX_Portal REQUIRED )
+include_directories(${CCNX_PORTAL_INCLUDE_DIRS})
+
+find_package ( Threads REQUIRED )
+
+find_package ( OpenSSL REQUIRED )
+find_package( Doxygen )
+
+find_package( Metis REQUIRED)
+include_directories(${Metis_INCLUDE_DIRS})
+
+add_library( # Sets the name of the library.
+ metisForwarderWrap
+
+ # Sets the library as a shared library.
+ SHARED
+
+ # Provides a relative path to your source file(s).
+ src/main/c/metisForwarderWrap.c )
+
+# Searches for a specified prebuilt library and stores the path as a
+# variable. Because CMake includes system libraries in the search path by
+# default, you only need to specify the name of the public NDK library
+# you want to add. CMake verifies that the library exists before
+# completing its build.
+
+find_library( # Sets the name of the path variable.
+ log-lib
+
+ # Specifies the name of the NDK library that
+ # you want CMake to locate.
+ log )
+
+# Specifies libraries CMake should link to your target library. You
+# can link multiple libraries, such as libraries you define in this
+# build script, prebuilt third-party libraries, or system libraries.
+target_link_libraries( # Specifies the target library.
+ metisForwarderWrap
+
+ # Links the target library to the log library
+ # included in the NDK.
+ ${log-lib} ${LIBMETIS_LIBRARIES} ${CCNX_PORTAL_LIBRARIES} ${CCNX_TRANSPORT_RTA_LIBRARIES} ${CCNX_COMMON_LIBRARIES} ${LIBPARC_LIBRARIES} ${LONGBOW_LIBRARIES} ${LIBEVENT_LIBRARIES} ${OPENSSL_LIBRARIES}) \ No newline at end of file
diff --git a/MetisForwarder/app/build.gradle b/MetisForwarder/app/build.gradle
new file mode 100644
index 00000000..18dd28c4
--- /dev/null
+++ b/MetisForwarder/app/build.gradle
@@ -0,0 +1,65 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
+ defaultConfig {
+ applicationId "metisforwarder.metis.com.metisforwarder"
+ minSdkVersion 24
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ externalNativeBuild {
+ cmake {
+ cppFlags "-frtti -fexceptions -Wno-error=format-security"
+ }
+ }
+ ndk {
+ // Specifies the ABI configurations of your native
+ // libraries Gradle should build and package with your APK.
+ abiFilters 'armeabi-v7a'
+ }
+ }
+
+ signingConfigs {
+ release {
+ storeFile file("metisforwarder.keystore")
+ storePassword "metisforwarder"
+ keyAlias "metisforwarder"
+ keyPassword "metisforwarder"
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ signingConfig signingConfigs.release
+ applicationVariants.all { variant ->
+ variant.outputs.each { output ->
+ project.ext { appName = 'metis-forwarder' }
+ def newName = output.outputFile.name
+ newName = newName.replace("app", "$project.ext.appName-$System.env.ABI")
+ output.outputFile = new File(output.outputFile.parent, newName)
+ }
+ }
+ }
+ }
+ externalNativeBuild {
+ cmake {
+ path "CMakeLists.txt"
+ }
+ }
+
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:appcompat-v7:25.2.0'
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ testCompile 'junit:junit:4.12'
+}
diff --git a/MetisForwarder/app/cmake/Modules/FindCCNX_Common.cmake b/MetisForwarder/app/cmake/Modules/FindCCNX_Common.cmake
new file mode 100644
index 00000000..2629c160
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindCCNX_Common.cmake
@@ -0,0 +1,39 @@
+########################################
+#
+# Find the Libparc libraries and includes
+# This module sets:
+# CCNX_COMMON_FOUND: True if Libparc was found
+# CCNX_COMMON_LIBRARY: The Libparc library
+# CCNX_COMMON_LIBRARIES: The Libparc library and dependencies
+# CCNX_COMMON_INCLUDE_DIR: The Libparc include dir
+#
+
+set(CCNX_COMMON_SEARCH_PATH_LIST
+ ${CCNX_COMMON_HOME}
+ $ENV{CCNX_COMMON_HOME}
+ $ENV{CCNX_HOME}
+ $ENV{PARC_HOME}
+ $ENV{FOUNDATION_HOME}
+ /usr/local/parc
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(CCNX_COMMON_INCLUDE_DIR ccnx/common/libccnxCommon_About.h
+ HINTS ${CCNX_COMMON_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the Libccnx-common includes" )
+
+find_library(CCNX_COMMON_LIBRARY NAMES ccnx_common
+ HINTS ${CCNX_COMMON_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the Libccnx-common libraries" )
+
+set(CCNX_COMMON_LIBRARIES ${CCNX_COMMON_LIBRARY})
+set(CCNX_COMMON_INCLUDE_DIRS ${CCNX_COMMON_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CCNX_Common DEFAULT_MSG CCNX_COMMON_LIBRARY CCNX_COMMON_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindCCNX_Portal.cmake b/MetisForwarder/app/cmake/Modules/FindCCNX_Portal.cmake
new file mode 100644
index 00000000..68384bab
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindCCNX_Portal.cmake
@@ -0,0 +1,40 @@
+########################################
+#
+# Find the Libccnx-transport libraries and includes
+# This module sets:
+# CCNX_PORTAL_FOUND: True if Libparc was found
+# CCNX_PORTAL_LIBRARY: The Libparc library
+# CCNX_PORTAL_LIBRARIES: The Libparc library and dependencies
+# CCNX_PORTAL_INCLUDE_DIR: The Libparc include dir
+#
+
+set(CCNX_PORTAL_SEARCH_PATH_LIST
+ ${CCNX_PORTAL_HOME}
+ $ENV{CCNX_PORTAL_HOME}
+ $ENV{CCNX_HOME}
+ $ENV{PARC_HOME}
+ $ENV{FOUNDATION_HOME}
+ /usr/local/parc
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(CCNX_PORTAL_INCLUDE_DIR ccnx/api/ccnx_Portal/ccnxPortal_About.h
+ HINTS ${CCNX_PORTAL_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the Libccnx-portal includes" )
+
+find_library(CCNX_PORTAL_LIBRARY NAMES ccnx_api_portal
+ HINTS ${CCNX_PORTAL_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the Libccnx-portal libraries" )
+
+set(CCNX_PORTAL_LIBRARIES ${CCNX_PORTAL_LIBRARY})
+
+set(CCNX_PORTAL_INCLUDE_DIRS ${CCNX_PORTAL_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CCNX_Portal DEFAULT_MSG CCNX_PORTAL_LIBRARY CCNX_PORTAL_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindCCNX_Transport_Rta.cmake b/MetisForwarder/app/cmake/Modules/FindCCNX_Transport_Rta.cmake
new file mode 100644
index 00000000..c43436d1
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindCCNX_Transport_Rta.cmake
@@ -0,0 +1,50 @@
+########################################
+#
+# Find the Libccnx-transport libraries and includes
+# This module sets:
+# CCNX_TRANSPORT_RTA_FOUND: True if Libparc was found
+# CCNX_TRANSPORT_RTA_LIBRARY: The Libparc library
+# CCNX_TRANSPORT_RTA_LIBRARIES: The Libparc library and dependencies
+# CCNX_TRANSPORT_RTA_INCLUDE_DIR: The Libparc include dir
+#
+
+set(CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST
+ ${CCNX_TRANSPORT_RTA_HOME}
+ $ENV{CCNX_TRANSPORT_RTA_HOME}
+ $ENV{CCNX_HOME}
+ $ENV{PARC_HOME}
+ $ENV{FOUNDATION_HOME}
+ /usr/local/parc
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(CCNX_TRANSPORT_RTA_INCLUDE_DIR ccnx/transport/librta_About.h
+ HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the Libccnx-transport-rta includes" )
+
+find_library(CCNX_TRANSPORT_RTA_LIBRARY NAMES ccnx_transport_rta
+ HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the Libccnx-transport-rta libraries" )
+
+find_library(CCNX_API_NOTIFY_LIBRARY NAMES ccnx_api_notify
+ HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the Libccnx-transport-rta libraries" )
+
+find_library(CCNX_API_CONTROL_LIBRARY NAMES ccnx_api_control
+ HINTS ${CCNX_TRANSPORT_RTA_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the Libccnx-transport-rta libraries" )
+
+set(CCNX_TRANSPORT_RTA_LIBRARIES ${CCNX_TRANSPORT_RTA_LIBRARY} ${CCNX_API_CONTROL_LIBRARY} ${CCNX_API_NOTIFY_LIBRARY})
+
+set(CCNX_TRANSPORT_RTA_INCLUDE_DIRS ${CCNX_TRANSPORT_RTA_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CCNX_Transport_Api DEFAULT_MSG CCNX_TRANSPORT_RTA_LIBRARY CCNX_TRANSPORT_RTA_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindLibEvent.cmake b/MetisForwarder/app/cmake/Modules/FindLibEvent.cmake
new file mode 100644
index 00000000..2d1ca4fe
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindLibEvent.cmake
@@ -0,0 +1,47 @@
+########################################
+#
+# Find the LibEvent libraries and includes
+# This module sets:
+# LIBEVENT_FOUND: True if LibEvent was found
+# LIBEVENT_LIBRARY: The LibEvent library
+# LIBEVENT_LIBRARIES: The LibEvent library and dependencies
+# LIBEVENT_INCLUDE_DIR: The LibEvent include dir
+#
+# This module will look for the libraries in various locations
+# See the LIBEVENT_SEARCH_PATH_LIST for a full list.
+#
+# The caller can hint at locations using the following variables:
+#
+# LIBEVENT_HOME (passed as -D to cmake)
+# CCNX_DEPENDENCIES (in environment)
+# LIBEVENT_HOME (in environment)
+# CCNX_HOME (in environment)
+#
+
+set(LIBEVENT_SEARCH_PATH_LIST
+ ${LIBEVENT_HOME}
+ $ENV{CCNX_DEPENDENCIES}
+ $ENV{LIBEVENT_HOME}
+ $ENV{CCNX_HOME}
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(LIBEVENT_INCLUDE_DIR event2/event.h
+ HINTS ${LIBEVENT_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the LibEvent includes" )
+
+find_library(LIBEVENT_LIBRARY NAMES event
+ HINTS ${LIBEVENT_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the LibEvent libraries" )
+
+set(LIBEVENT_LIBRARIES ${LIBEVENT_LIBRARY})
+set(LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibEvent DEFAULT_MSG LIBEVENT_LIBRARY LIBEVENT_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindLibicnet.cmake b/MetisForwarder/app/cmake/Modules/FindLibicnet.cmake
new file mode 100644
index 00000000..4472060b
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindLibicnet.cmake
@@ -0,0 +1,39 @@
+########################################
+#
+# Find the Libparc libraries and includes
+# This module sets:
+# LIBICNET_FOUND: True if Libconsumer-producer was found
+# LIBICNETR_LIBRARY: The Libconsumer-producer library
+# LIBICNET_LIBRARIES: The Libconsumer-producer library and dependencies
+# LIBICNET_INCLUDE_DIR: The Libconsumer-producer include dir
+#
+
+set(LIBICNET_SEARCH_PATH_LIST
+ ${LIBICNET_HOME}
+ $ENV{LIBICNETHOME}
+ $ENV{CCNX_HOME}
+ $ENV{PARC_HOME}
+ $ENV{FOUNDATION_HOME}
+ /usr/local/parc
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(LIBICNET_INCLUDE_DIR icnet/icnet_transport_common.h
+ HINTS ${LIBICNET_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the libicnet includes")
+
+find_library(LIBICNET_LIBRARY NAMES icnet
+ HINTS ${LIBICNET_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the libicnet libraries")
+message("---->${LIBICNET_LIBRARY} ${LIBICNET_INCLUDE_DIR}")
+set(LIBICNET_LIBRARIES ${LIBICNET_LIBRARY})
+set(LIBICNET_INCLUDE_DIRS ${LIBICNET_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libicnet DEFAULT_MSG LIBICNET_LIBRARY LIBICNET_INCLUDE_DIR) \ No newline at end of file
diff --git a/MetisForwarder/app/cmake/Modules/FindLibparc.cmake b/MetisForwarder/app/cmake/Modules/FindLibparc.cmake
new file mode 100644
index 00000000..02835161
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindLibparc.cmake
@@ -0,0 +1,39 @@
+########################################
+#
+# Find the Libparc libraries and includes
+# This module sets:
+# LIBPARC_FOUND: True if Libparc was found
+# LIBPARC_LIBRARY: The Libparc library
+# LIBPARC_LIBRARIES: The Libparc library and dependencies
+# LIBPARC_INCLUDE_DIR: The Libparc include dir
+#
+
+set(LIBPARC_SEARCH_PATH_LIST
+ ${LIBPARC_HOME}
+ $ENV{LIBPARC_HOME}
+ $ENV{CCNX_HOME}
+ $ENV{PARC_HOME}
+ $ENV{FOUNDATION_HOME}
+ /usr/local/parc
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(LIBPARC_INCLUDE_DIR parc/libparc_About.h
+ HINTS ${LIBPARC_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the Libparc includes" )
+
+find_library(LIBPARC_LIBRARY NAMES parc
+ HINTS ${LIBPARC_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the Libparc libraries" )
+
+set(LIBPARC_LIBRARIES ${LIBPARC_LIBRARY})
+set(LIBPARC_INCLUDE_DIRS ${LIBPARC_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libparc DEFAULT_MSG LIBPARC_LIBRARY LIBPARC_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindLongBow.cmake b/MetisForwarder/app/cmake/Modules/FindLongBow.cmake
new file mode 100644
index 00000000..e35888eb
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindLongBow.cmake
@@ -0,0 +1,44 @@
+########################################
+#
+# Find the LongBow libraries and includes
+# This module sets:
+# LONGBOW_FOUND: True if LongBow was found
+# LONGBOW_LIBRARY: The LongBow library
+# LONGBOW_LIBRARIES: The LongBow library and dependencies
+# LONGBOW_INCLUDE_DIR: The LongBow include dir
+#
+
+set(LONGBOW_SEARCH_PATH_LIST
+ ${LONGBOW_HOME}
+ $ENV{LONGBOW_HOME}
+ $ENV{CCNX_HOME}
+ $ENV{PARC_HOME}
+ $ENV{FOUNDATION_HOME}
+ /usr/local/parc
+ /usr/local/ccnx
+ /usr/local/ccn
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(LONGBOW_INCLUDE_DIR LongBow/longBow_About.h
+ HINTS ${LONGBOW_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the LongBow includes" )
+
+find_library(LONGBOW_LIBRARY NAMES longbow
+ HINTS ${LONGBOW_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the LongBow libraries" )
+
+find_library(LONGBOW_REPORT_LIBRARY NAMES longbow-textplain longbow-ansiterm
+ HINTS ${LONGBOW_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the LongBow report libraries" )
+
+set(LONGBOW_LIBRARIES ${LONGBOW_LIBRARY} ${LONGBOW_REPORT_LIBRARY})
+set(LONGBOW_INCLUDE_DIRS ${LONGBOW_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LongBow DEFAULT_MSG LONGBOW_LIBRARY LONGBOW_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindMetis.cmake b/MetisForwarder/app/cmake/Modules/FindMetis.cmake
new file mode 100644
index 00000000..a3b4bff1
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindMetis.cmake
@@ -0,0 +1,41 @@
+########################################
+#
+# Find the LibMetis libraries and includes
+# This module sets:
+# LIBMETIS_FOUND: True if Libmetis was found
+# LIBMETIS_LIBRARY: The Libmetis library
+# LIBMETIS_LIBRARIES: The Libmetis library and dependencies
+# LIBMETIS_INCLUDE_DIR: The Libmetis include dir
+#
+
+set(METIS_SEARCH_PATH_LIST
+
+${LIBMETISHOME}
+$ENV{LIBMETISHOME}
+$ENV{CCNX_HOME}
+$ENV{FOUNDATION_HOME}
+/usr/local/
+/usr/local/ccnx
+/usr/local/ccn
+/usr/local
+/opt
+/usr
+)
+
+
+
+find_path(METIS_INCLUDE_DIR ccnx/forwarder/metis/metis_About.h
+HINTS ${METIS_SEARCH_PATH_LIST}
+PATH_SUFFIXES include
+DOC "Find the libmetis includes")
+
+find_library(LIBMETIS_LIBRARY NAMES metis
+HINTS ${LIBMETIS_SEARCH_PATH_LIST}
+PATH_SUFFIXES lib
+DOC "Find the libmetis libraries")
+
+set(LIBMETIS_LIBRARIES ${LIBMETIS_LIBRARY})
+set(LIBMETIS_INCLUDE_DIRS ${LIBMETIS_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libmetis DEFAULT_MSG LIBMETIS_LIBRARY LIBMETIS_INCLUDE_DIR)
diff --git a/MetisForwarder/app/cmake/Modules/FindUncrustify.cmake b/MetisForwarder/app/cmake/Modules/FindUncrustify.cmake
new file mode 100644
index 00000000..e53f65fe
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/FindUncrustify.cmake
@@ -0,0 +1,8 @@
+# Find uncrustify program
+#
+find_program( UNCRUSTIFY_BIN uncrustify
+ PATHS
+ $ENV{UNCRUSTIFY_HOME}
+ )
+
+message( "-- UNCRUSTIFY found in ${UNCRUSTIFY_BIN}" )
diff --git a/MetisForwarder/app/cmake/Modules/detectCacheSize.cmake b/MetisForwarder/app/cmake/Modules/detectCacheSize.cmake
new file mode 100644
index 00000000..469d2627
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/detectCacheSize.cmake
@@ -0,0 +1,21 @@
+# Detect the cache size
+#
+# XXX: TODO: This is a bug when cross compiling. We are detecting the local
+# Cache Line size and not the target cache line size. We should provide some
+# way to define this
+
+set(LEVEL1_DCACHE_LINESIZE 32)
+
+if( APPLE )
+ execute_process(COMMAND sysctl -n hw.cachelinesize
+ OUTPUT_VARIABLE LEVEL1_DCACHE_LINESIZE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif( APPLE )
+
+if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
+ execute_process(COMMAND getconf LEVEL1_DCACHE_LINESIZE
+ OUTPUT_VARIABLE LEVEL1_DCACHE_LINESIZE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+message("-- Cache line size: ${LEVEL1_DCACHE_LINESIZE}")
diff --git a/MetisForwarder/app/cmake/Modules/version.cmake b/MetisForwarder/app/cmake/Modules/version.cmake
new file mode 100644
index 00000000..74831674
--- /dev/null
+++ b/MetisForwarder/app/cmake/Modules/version.cmake
@@ -0,0 +1,15 @@
+#
+# Get a version to pass on the command line
+#
+execute_process(COMMAND ${PROJECT_SOURCE_DIR}/cmake/get_version.sh ${PROJECT_SOURCE_DIR}
+ OUTPUT_VARIABLE RELEASE_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+execute_process(COMMAND date -u +%Y-%m-%dT%H:%M:%SZ
+ OUTPUT_VARIABLE ISO_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+MESSAGE( STATUS "Configuring version ${RELEASE_VERSION}" )
+
+add_definitions("-DRELEASE_VERSION=\"${RELEASE_VERSION}\"")
+
diff --git a/MetisForwarder/app/cmake/get_version.sh b/MetisForwarder/app/cmake/get_version.sh
new file mode 100755
index 00000000..34c6ddb2
--- /dev/null
+++ b/MetisForwarder/app/cmake/get_version.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+DATE_VERSION=`date "+%Y%m%d"`
+
+if [ ! -d $1 ]; then
+ echo 0.$DATE_VERSION
+ exit
+fi
+
+if [ -f $1/BASE_VERSION ]; then
+ BASE_VERSION=`cat $1/BASE_VERSION`.
+fi
+
+GIT=`which git`
+
+if test -x $GIT -a -f $1/.git/config; then
+ GIT_VERSION=.`git -C $1 rev-parse HEAD | cut -c 1-8`
+fi
+
+echo $BASE_VERSION$DATE_VERSION$GIT_VERSION
diff --git a/MetisForwarder/app/metisforwarder.keystore b/MetisForwarder/app/metisforwarder.keystore
new file mode 100644
index 00000000..06f918cc
--- /dev/null
+++ b/MetisForwarder/app/metisforwarder.keystore
Binary files differ
diff --git a/MetisForwarder/app/proguard-rules.pro b/MetisForwarder/app/proguard-rules.pro
new file mode 100644
index 00000000..9366e766
--- /dev/null
+++ b/MetisForwarder/app/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/angelomantellini/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/MetisForwarder/app/src/androidTest/java/com/metis/ccnx/metisforwarder/ExampleInstrumentedTest.java b/MetisForwarder/app/src/androidTest/java/com/metis/ccnx/metisforwarder/ExampleInstrumentedTest.java
new file mode 100644
index 00000000..1d597bd0
--- /dev/null
+++ b/MetisForwarder/app/src/androidTest/java/com/metis/ccnx/metisforwarder/ExampleInstrumentedTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.metis.ccnx.metisforwarder;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.metis.ccnx.metisforwarder", appContext.getPackageName());
+ }
+}
diff --git a/MetisForwarder/app/src/main/AndroidManifest.xml b/MetisForwarder/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..f50951dd
--- /dev/null
+++ b/MetisForwarder/app/src/main/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="metisforwarder.metis.com.metisforwarder">
+
+ <application
+ android:allowBackup="true"
+ android:configChanges="orientation|screenSize|keyboard"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ <activity android:name="com.metis.ccnx.metisforwarder.MetisForwarderActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <service
+ android:name="com.metis.ccnx.service.MetisForwarderService"
+ android:permission="android.permission.BIND_VPN_SERVICE">
+ </service>
+ </application>
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission
+ android:name="android.permission.READ_EXTERNAL_STORAGE"
+ android:maxSdkVersion="21" />
+
+</manifest>
diff --git a/MetisForwarder/app/src/main/c/metisForwarderWrap.c b/MetisForwarder/app/src/main/c/metisForwarderWrap.c
new file mode 100644
index 00000000..d0603d5c
--- /dev/null
+++ b/MetisForwarder/app/src/main/c/metisForwarderWrap.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <jni.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <android/log.h>
+#include <stdbool.h>
+#include <ccnx/forwarder/metis/core/metis_Forwarder.h>
+
+
+static bool _isRunning = false;
+MetisForwarder *metis = NULL;
+
+JNIEXPORT void JNICALL
+Java_com_metis_ccnx_supportlibrary_MetisForwarder_start(JNIEnv *env, jobject instance,
+ jstring path_) {
+
+ if (!_isRunning) {
+ metis = metisForwarder_Create(NULL);
+
+ MetisConfiguration *configuration = metisForwarder_GetConfiguration(metis);
+ metisConfiguration_SetObjectStoreSize(configuration, 0);
+ metisConfiguration_StartCLI(configuration, 2001);
+ if (path_) {
+ const char *configFileName = (*env)->GetStringUTFChars(env, path_, 0);
+ metisForwarder_SetupFromConfigFile(metis, configFileName);
+ } else {
+ metisForwarder_SetupAllListeners(metis, PORT_NUMBER, NULL);
+ }
+ MetisDispatcher *dispatcher = metisForwarder_GetDispatcher(metis);
+ _isRunning = true;
+ metisDispatcher_Run(dispatcher);
+ }
+
+
+}
+
+JNIEXPORT void JNICALL
+Java_com_metis_ccnx_supportlibrary_MetisForwarder_stop(JNIEnv *env, jobject instance) {
+
+ if (_isRunning) {
+ __android_log_print(ANDROID_LOG_DEBUG, "MetisForwarderWrap", "stopping Metis...");
+ metisDispatcher_Stop(metisForwarder_GetDispatcher(metis));
+
+ sleep(2);
+ metisForwarder_Destroy(&metis);
+ _isRunning = false;
+ }
+
+}
+
+JNIEXPORT jboolean JNICALL
+Java_com_metis_ccnx_supportlibrary_MetisForwarder_isRunning(JNIEnv *env, jobject instance) {
+
+ return _isRunning;
+
+}
diff --git a/MetisForwarder/app/src/main/java/com/metis/ccnx/metisforwarder/MetisForwarderActivity.java b/MetisForwarder/app/src/main/java/com/metis/ccnx/metisforwarder/MetisForwarderActivity.java
new file mode 100644
index 00000000..8d1294e4
--- /dev/null
+++ b/MetisForwarder/app/src/main/java/com/metis/ccnx/metisforwarder/MetisForwarderActivity.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.metis.ccnx.metisforwarder;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.util.Log;
+import android.widget.Switch;
+import android.widget.CompoundButton;
+import android.widget.Spinner;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+
+import metisforwarder.metis.com.metisforwarder.R;
+
+import com.metis.ccnx.service.MetisForwarderService;
+import com.metis.ccnx.supportlibrary.MetisForwarder;
+import com.metis.ccnx.utility.Constants;
+import com.metis.ccnx.utility.ResourcesEnumerator;
+
+
+public class MetisForwarderActivity extends AppCompatActivity {
+ private Spinner sourceIpSpinner;
+ private EditText sourcePortEditText;
+ private EditText nextHopIpEditText;
+ private EditText nextHopPortEditText;
+ private EditText configurationEditText;
+ private EditText prefixEditText;
+ private Switch metisForwarderSwitch;
+ private Button sourceIpRefreshButton;
+ private List<String> sourceIpArrayList = new ArrayList<String>();
+ private List<String> sourceNetworkInterfaceArrayList = new ArrayList<>();
+ private HashMap<String, String> addressesMap = new HashMap<String, String>();
+ private SharedPreferences sharedPreferences;
+ private View _selectedItemView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_metis_forwarder);
+ checkEnabledPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ checkEnabledPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
+ init();
+ }
+
+ public HashMap<String, String> getLocalIpAddress() {
+ HashMap<String, String> addressesMap = new HashMap<String, String>();
+ try {
+ for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
+ NetworkInterface intf = en.nextElement();
+ for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
+ InetAddress inetAddress = enumIpAddr.nextElement();
+ if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) {
+ String[] addressSplitted = inetAddress.getHostAddress().toString().split("%");
+ //addressesMap.put(addressSplitted[1], addressSplitted[0]);
+ addressesMap.put(intf.getName(), addressSplitted[0]);
+ }
+ }
+ }
+ } catch (SocketException ex) {
+ String LOG_TAG = null;
+ Log.e(LOG_TAG, ex.toString());
+ }
+ return addressesMap;
+ }
+
+ private void checkEnabledPermission(String permission) {
+ if (ContextCompat.checkSelfPermission(this,
+ permission)
+ != PackageManager.PERMISSION_GRANTED) {
+ if (ActivityCompat.shouldShowRequestPermissionRationale(this,
+ permission)) {
+ } else {
+ ActivityCompat.requestPermissions(this,
+ new String[]{permission},
+ 1);
+ }
+ }
+ }
+
+ private void init() {
+ sourceIpSpinner = (Spinner) findViewById(R.id.sourceIpSpinner);
+ sharedPreferences = getSharedPreferences(Constants.METIS_FORWARDER_PREFERENCES, MODE_PRIVATE);
+ addressesMap = getLocalIpAddress();
+ for (String networkInterface : addressesMap.keySet()) {
+ sourceIpArrayList.add(networkInterface + ": " + addressesMap.get(networkInterface));
+ sourceNetworkInterfaceArrayList.add(networkInterface);
+ }
+ if (addressesMap.size() > 0) {
+ ArrayAdapter<String> sourceIpSpinnerArrayAdapter = new ArrayAdapter<String>(this,
+ android.R.layout.simple_spinner_item, sourceIpArrayList);
+ sourceIpSpinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ sourceIpSpinnerArrayAdapter.setDropDownViewResource(R.layout.spinner_layout);
+ sourceIpSpinner.setAdapter(sourceIpSpinnerArrayAdapter);
+ if (sourceNetworkInterfaceArrayList.indexOf(sharedPreferences.getString(ResourcesEnumerator.SOURCE_NETWORK_INTERFACE.key(), Constants.DEFAULT_SOURCE_INTERFACE)) > -1) {
+ sourceIpSpinner.setSelection(sourceNetworkInterfaceArrayList.indexOf(sharedPreferences.getString(ResourcesEnumerator.SOURCE_NETWORK_INTERFACE.key(), Constants.DEFAULT_SOURCE_INTERFACE)));
+ } else {
+ sourceIpSpinner.setSelection(0);
+ }
+ }
+ sourcePortEditText = (EditText) findViewById(R.id.sourcePortEditText);
+ sourcePortEditText.setText(sharedPreferences.getString(ResourcesEnumerator.SOURCE_PORT.key(), Constants.DEFAULT_SOURCE_PORT));
+ sourceIpRefreshButton = (Button) findViewById(R.id.sourceIpRefreshButton);
+ sourceIpRefreshButton.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ addressesMap = getLocalIpAddress();
+ sourceIpArrayList.clear();
+ sourceNetworkInterfaceArrayList.clear();
+ for (String networkInterface : addressesMap.keySet()) {
+ sourceIpArrayList.add(networkInterface + ": " + addressesMap.get(networkInterface));
+ sourceNetworkInterfaceArrayList.add(addressesMap.get(networkInterface));
+ }
+ if (addressesMap.size() > 0) {
+ ArrayAdapter<String> sourceIpComboArrayAdapter = new ArrayAdapter<String>(v.getContext(),
+ android.R.layout.simple_spinner_item, sourceIpArrayList);
+ sourceIpComboArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ sourceIpComboArrayAdapter.setDropDownViewResource(R.layout.spinner_layout);
+ sourceIpSpinner.setAdapter(sourceIpComboArrayAdapter);
+ if (sourceNetworkInterfaceArrayList.indexOf(sharedPreferences.getString(ResourcesEnumerator.SOURCE_NETWORK_INTERFACE.key(), Constants.DEFAULT_SOURCE_INTERFACE)) > -1) {
+ sourceIpSpinner.setSelection(sourceNetworkInterfaceArrayList.indexOf(sharedPreferences.getString(ResourcesEnumerator.SOURCE_NETWORK_INTERFACE.key(), Constants.DEFAULT_SOURCE_INTERFACE)));
+ } else {
+ sourceIpSpinner.setSelection(0);
+ }
+ }
+ }
+ });
+ nextHopIpEditText = (EditText) findViewById(R.id.nextHopIpEditText);
+ nextHopIpEditText.setText(sharedPreferences.getString(ResourcesEnumerator.NEXT_HOP_IP.key(), Constants.DEFAULT_NEXT_HOP_IP));
+ nextHopPortEditText = (EditText) findViewById(R.id.nextHopPortEditText);
+ nextHopPortEditText.setText(sharedPreferences.getString(ResourcesEnumerator.NEXT_HOP_PORT.key(), Constants.DEFAULT_NEXT_HOP_PORT));
+
+ configurationEditText = (EditText) findViewById(R.id.configurationEditText);
+ //configurationEditText.setText(sharedPreferences.getString(ResourcesEnumerator.CONFIGURATION.key(), Constants.DEFAULT_CONFIGURATION));
+ configurationEditText.setText(Constants.DEFAULT_CONFIGURATION);
+ prefixEditText = (EditText) findViewById(R.id.prefixEditText);
+ prefixEditText.setText(sharedPreferences.getString(ResourcesEnumerator.PREFIX.key(), Constants.DEFAULT_PREFIX));
+ metisForwarderSwitch = (Switch) findViewById(R.id.metisForwarderSwitch);
+ metisForwarderSwitch.setText(Constants.DISABLED);
+ metisForwarderSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ Log.v("Switch State=", "" + isChecked);
+ if (isChecked) {
+ metisForwarderSwitch.setText(Constants.ENABLED);
+ SharedPreferences.Editor sharedPreferencesEditor = getSharedPreferences(Constants.METIS_FORWARDER_PREFERENCES, MODE_PRIVATE).edit();
+ sharedPreferencesEditor.putString(ResourcesEnumerator.SOURCE_NETWORK_INTERFACE.key(), sourceNetworkInterfaceArrayList.get(sourceIpSpinner.getSelectedItemPosition()));
+ sharedPreferencesEditor.putString(ResourcesEnumerator.SOURCE_IP.key(), addressesMap.get(sourceNetworkInterfaceArrayList.get(sourceIpSpinner.getSelectedItemPosition())));
+ sharedPreferencesEditor.putString(ResourcesEnumerator.SOURCE_PORT.key(), sourcePortEditText.getText().toString());
+ sharedPreferencesEditor.putString(ResourcesEnumerator.NEXT_HOP_IP.key(), nextHopIpEditText.getText().toString());
+ sharedPreferencesEditor.putString(ResourcesEnumerator.NEXT_HOP_PORT.key(), nextHopPortEditText.getText().toString());
+ sharedPreferencesEditor.putString(ResourcesEnumerator.CONFIGURATION.key(), configurationEditText.getText().toString());
+ sharedPreferencesEditor.putString(ResourcesEnumerator.PREFIX.key(), prefixEditText.getText().toString());
+ sharedPreferencesEditor.commit();
+ sourceIpSpinner.setEnabled(false);
+ sourceIpRefreshButton.setEnabled(false);
+ sourcePortEditText.setEnabled(false);
+ nextHopIpEditText.setEnabled(false);
+ nextHopPortEditText.setEnabled(false);
+ prefixEditText.setEnabled(false);
+ configurationEditText.setEnabled(false);
+ startMetisForwarder();
+
+ } else {
+ metisForwarderSwitch.setText(Constants.DISABLED);
+ sourceIpSpinner.setEnabled(true);
+ sourceIpRefreshButton.setEnabled(true);
+ sourcePortEditText.setEnabled(true);
+ nextHopIpEditText.setEnabled(true);
+ nextHopPortEditText.setEnabled(true);
+ prefixEditText.setEnabled(true);
+ configurationEditText.setEnabled(true);
+ stopMetisForwarder();
+ }
+ }
+
+ });
+
+
+ }
+
+ private void startMetisForwarder() {
+ Intent intent = new Intent(this, MetisForwarderService.class);
+ startService(intent);
+ }
+
+ private void stopMetisForwarder() {
+ Intent intent = new Intent(this, MetisForwarderService.class);
+
+ stopService(intent);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ }
+}
diff --git a/MetisForwarder/app/src/main/java/com/metis/ccnx/service/MetisForwarderService.java b/MetisForwarder/app/src/main/java/com/metis/ccnx/service/MetisForwarderService.java
new file mode 100644
index 00000000..25d7c68a
--- /dev/null
+++ b/MetisForwarder/app/src/main/java/com/metis/ccnx/service/MetisForwarderService.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.metis.ccnx.service;
+
+import android.app.Notification;
+import android.app.Service;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.os.IBinder;
+import android.util.Log;
+
+import com.metis.ccnx.supportlibrary.MetisForwarder;
+import com.metis.ccnx.utility.Constants;
+import com.metis.ccnx.utility.ResourcesEnumerator;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+public class MetisForwarderService extends Service {
+ private final static String TAG = "MetisForwarderService";
+
+ private static Thread sForwarderThread = null;
+
+ public MetisForwarderService() {
+ }
+
+ private String path;
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+
+ MetisForwarder metisForwarder = MetisForwarder.getInstance();
+ if (!metisForwarder.isRunning()) {
+ Log.d(TAG, "Starting Metis Forwarder");
+ SharedPreferences sharedPreferences = getSharedPreferences(Constants.METIS_FORWARDER_PREFERENCES, MODE_PRIVATE);
+ String configuration = sharedPreferences.getString(ResourcesEnumerator.CONFIGURATION.key(), Constants.DEFAULT_CONFIGURATION);
+ String sourceIp = sharedPreferences.getString(ResourcesEnumerator.SOURCE_IP.key(), null);
+ String sourcePort = sharedPreferences.getString(ResourcesEnumerator.SOURCE_PORT.key(), null);
+ String nextHopIp = sharedPreferences.getString(ResourcesEnumerator.NEXT_HOP_IP.key(), null);
+ String nextHopPort = sharedPreferences.getString(ResourcesEnumerator.NEXT_HOP_PORT.key(), null);
+ String prefix = sharedPreferences.getString(ResourcesEnumerator.PREFIX.key(), null);
+ configuration = configuration.replace(Constants.SOURCE_IP, sourceIp);
+ configuration = configuration.replace(Constants.SOURCE_PORT, sourcePort);
+ configuration = configuration.replace(Constants.NEXT_HOP_IP, nextHopIp);
+ configuration = configuration.replace(Constants.NEXT_HOP_PORT, nextHopPort);
+ configuration = configuration.replace(Constants.PREFIX, prefix);
+ try {
+ String configurationDir = getPackageManager().getPackageInfo(getPackageName(), 0).applicationInfo.dataDir +
+ File.separator + Constants.CONFIGURATION_PATH;
+ File folder = new File(configurationDir);
+ if (!folder.exists()) {
+ folder.mkdirs();
+ }
+
+ writeToFile(configuration, configurationDir + File.separator + Constants.CONFIGURATION_FILE_NAME);
+ startForwarder(intent, configurationDir + File.separator + Constants.CONFIGURATION_FILE_NAME);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.w(TAG, "Error Package name not found ", e);
+ }
+
+
+ } else {
+ Log.d(TAG, "Metis Forwarder already running.");
+ }
+ return Service.START_STICKY;
+ }
+
+
+ @Override
+ public void onDestroy() {
+ MetisForwarder metisForwarder = MetisForwarder.getInstance();
+ Log.d(TAG, "Destroying Metis Forwarder");
+ if (metisForwarder.isRunning()) {
+ metisForwarder.stop();
+ stopForeground(true);
+ }
+ super.onDestroy();
+ }
+
+ protected Runnable mForwarderRunner = new Runnable() {
+
+ //private String path;
+ @Override
+ public void run() {
+ MetisForwarder metisForwarder = MetisForwarder.getInstance();
+ metisForwarder.start(path);
+ }
+
+
+ };
+
+ private boolean writeToFile(String data, String path) {
+ Log.v(TAG, path + " " + data);
+ try (Writer writer = new BufferedWriter(new OutputStreamWriter(
+ new FileOutputStream(path), "utf-8"))) {
+ writer.write(data);
+ return true;
+ } catch (IOException e) {
+ Log.e(TAG, "File write failed: " + e.toString());
+ return false;
+ }
+ }
+
+
+ private void startForwarder(Intent intent, String path) {
+
+ int NOTIFICATION_ID = 12345;
+ startForeground(Constants.FOREGROUND_SERVICE, new Notification.Builder(this).build());
+ MetisForwarder metisForwarder = MetisForwarder.getInstance();
+ if (!metisForwarder.isRunning()) {
+ this.path = path;
+ sForwarderThread = new Thread(mForwarderRunner, "MetisForwarderRunner");
+ sForwarderThread.start();
+ }
+
+
+
+ }
+
+
+
+}
diff --git a/MetisForwarder/app/src/main/java/com/metis/ccnx/supportlibrary/MetisForwarder.java b/MetisForwarder/app/src/main/java/com/metis/ccnx/supportlibrary/MetisForwarder.java
new file mode 100644
index 00000000..45932cfa
--- /dev/null
+++ b/MetisForwarder/app/src/main/java/com/metis/ccnx/supportlibrary/MetisForwarder.java
@@ -0,0 +1,42 @@
+
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.metis.ccnx.supportlibrary;
+
+public class MetisForwarder {
+
+ private static MetisForwarder sInstance = null;
+
+ static {
+ System.loadLibrary("metisForwarderWrap");
+ }
+
+ public static MetisForwarder getInstance() {
+ if (sInstance == null) {
+ sInstance = new MetisForwarder();
+ }
+ return sInstance;
+ }
+
+ private MetisForwarder() {
+
+ }
+
+ public native boolean isRunning();
+ public native void start(String path);
+ public native void stop();
+}
diff --git a/MetisForwarder/app/src/main/java/com/metis/ccnx/utility/Constants.java b/MetisForwarder/app/src/main/java/com/metis/ccnx/utility/Constants.java
new file mode 100644
index 00000000..f25bc825
--- /dev/null
+++ b/MetisForwarder/app/src/main/java/com/metis/ccnx/utility/Constants.java
@@ -0,0 +1,34 @@
+package com.metis.ccnx.utility;
+
+/**
+ * Created by angelomantellini on 18/05/2017.
+ */
+
+public class Constants {
+ public static final String DEFAULT_NEXT_HOP_IP = "10.60.17.200";
+ public static final String DEFAULT_NEXT_HOP_PORT = "11111";
+ public static final String DEFAULT_PREFIX = "ccnx:/webserver";
+ public static final String ENABLED = "Enabled";
+ public static final String DISABLED = "Disabled";
+ public static final String METIS_FORWARDER_PREFERENCES = "metisForwarderPreferences";
+ public static final String DEFAULT_SOURCE_INTERFACE = "eth0";
+ public static final String DEFAULT_SOURCE_PORT = "11111";
+ public static final String DEFAULT_CONFIGURATION = "add listener tcp local0 127.0.0.1 9695\n" +
+ "add listener udp remote0 %%source_ip%% %%source_port%%\n" +
+ "add connection udp conn0 %%next_hop_ip%% %%next_hop_port%% %%source_ip%% %%source_port%%\n" +
+ "add route conn0 %%prefix%% 1";
+
+
+
+ //"add connection udp conn0 %%next_ip%% %%next_port_ip%% %%source_ip%% %%source_port%%\n" +
+ //"add route conn0 %%prefix%%";
+ public static final String SOURCE_IP = "%%source_ip%%";
+ public static final String SOURCE_PORT = "%%source_port%%";
+ public static final String NEXT_HOP_IP = "%%next_hop_ip%%";
+ public static final String NEXT_HOP_PORT = "%%next_hop_port%%";
+ public static final String PREFIX = "%%prefix%%";
+ public static final String NETMASK = "%%netmask%%";
+ public static final String CONFIGURATION_PATH = "Configuration";
+ public static final String CONFIGURATION_FILE_NAME = "metis_forwarder.conf";
+ public static final int FOREGROUND_SERVICE = 101;
+}
diff --git a/MetisForwarder/app/src/main/java/com/metis/ccnx/utility/ResourcesEnumerator.java b/MetisForwarder/app/src/main/java/com/metis/ccnx/utility/ResourcesEnumerator.java
new file mode 100644
index 00000000..85284f86
--- /dev/null
+++ b/MetisForwarder/app/src/main/java/com/metis/ccnx/utility/ResourcesEnumerator.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.metis.ccnx.utility;
+
+public enum ResourcesEnumerator {
+ SOURCE_IP("sourceIp"),
+ SOURCE_PORT("sourcePort"),
+ NEXT_HOP_IP("nextHopIp"),
+ NEXT_HOP_PORT("nextHopPort"),
+ CONFIGURATION("configuration"),
+ SOURCE_NETWORK_INTERFACE("sourceNetworkInterface"),
+ PREFIX("prefix");
+
+ private String key;
+
+ ResourcesEnumerator(String key) {
+ this.key = key;
+ }
+
+ public String key() {
+ return key;
+ }
+}
diff --git a/MetisForwarder/app/src/main/res/drawable/border.xml b/MetisForwarder/app/src/main/res/drawable/border.xml
new file mode 100644
index 00000000..c1f839b3
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/drawable/border.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <stroke
+ android:width="1dp"
+ android:color="#000000" />
+ <solid
+ android:color="#00FFFFFF"
+ android:paddingLeft="10dp"
+ android:paddingTop="10dp"/>
+
+ <padding
+ android:left="10dp"
+ android:top="10dp"
+ android:right="10dp"
+ android:bottom="10dp" />
+ <corners
+ android:bottomRightRadius="15dp"
+ android:bottomLeftRadius="15dp"
+ android:topLeftRadius="15dp"
+ android:topRightRadius="15dp"/>
+</shape> \ No newline at end of file
diff --git a/MetisForwarder/app/src/main/res/layout/activity_metis_forwarder.xml b/MetisForwarder/app/src/main/res/layout/activity_metis_forwarder.xml
new file mode 100644
index 00000000..ce9cc47c
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/layout/activity_metis_forwarder.xml
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.metis.ccnx.metisforwarder.MetisForwarderActivity">
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintHorizontal_bias="0.099"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.029999971">
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/sourceTextView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Source"
+ android:textSize="30sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:orientation="horizontal"
+ android:paddingLeft="30dp">
+
+ <TextView
+ android:id="@+id/sourceIpTextView"
+ android:layout_width="130dp"
+ android:layout_height="wrap_content"
+ android:text="IP"
+ android:textAlignment="textEnd"
+ android:textSize="24sp"
+ android:textStyle="bold" />
+
+ <Spinner
+ android:id="@+id/sourceIpSpinner"
+ android:layout_width="500dp"
+ android:layout_height="wrap_content"
+ android:paddingLeft="200dp" />
+
+ <Button
+ android:id="@+id/sourceIpRefreshButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Refresh" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:orientation="horizontal"
+ android:paddingLeft="30dp">
+
+ <TextView
+ android:id="@+id/sourcePortTextView"
+ android:layout_width="130dp"
+ android:layout_height="wrap_content"
+ android:text="Port"
+ android:textAlignment="textEnd"
+ android:textSize="24sp"
+ android:textStyle="bold" />
+
+ <EditText
+ android:id="@+id/sourcePortEditText"
+ android:layout_width="80dp"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="number"
+ android:text="88888"
+ android:textSize="24sp" />
+
+ </LinearLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/nextHopTextView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Next Hop"
+ android:textSize="30sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:orientation="horizontal"
+ android:paddingLeft="30dp">
+
+ <TextView
+ android:id="@+id/destinationIpTextView"
+ android:layout_width="130dp"
+ android:layout_height="wrap_content"
+ android:text="IP"
+ android:textAlignment="textEnd"
+ android:textSize="24sp"
+ android:textStyle="bold" />
+
+ <EditText
+ android:id="@+id/nextHopIpEditText"
+ android:layout_width="500dp"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="textUri"
+ android:text="8888:8888:8888:8888:8888:8888:8888:8888"
+ android:textSize="24sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:orientation="horizontal"
+ android:paddingLeft="30dp">
+
+ <TextView
+ android:id="@+id/nextHopPortTextView"
+ android:layout_width="130dp"
+ android:layout_height="wrap_content"
+ android:text="Port"
+ android:textAlignment="textEnd"
+ android:textSize="24sp"
+ android:textStyle="bold" />
+
+ <EditText
+ android:id="@+id/nextHopPortEditText"
+ android:layout_width="80dp"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="number"
+ android:text="88888"
+ android:textSize="24sp" />
+
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/routeTextView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Route"
+ android:textSize="30sp"
+ android:textStyle="bold" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:orientation="horizontal"
+ android:paddingLeft="30dp">
+
+ <TextView
+ android:id="@+id/prefixTextView"
+ android:layout_width="130dp"
+ android:layout_height="wrap_content"
+ android:text="Prefix"
+ android:textAlignment="textEnd"
+ android:textSize="24sp"
+ android:textStyle="bold" />
+
+ <EditText
+ android:id="@+id/prefixEditText"
+ android:layout_width="500dp"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="textUri"
+ android:text="8888:8888:8888:8888:8888:8888:8888:8888"
+ android:textSize="24sp" />
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/configurationTextView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Configuration"
+ android:textSize="30sp"
+ android:textStyle="bold" />
+
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="200dp"
+ android:background="@drawable/border">
+
+ <EditText
+ android:id="@+id/configurationEditText"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="@android:color/transparent"
+ android:ems="10"
+ android:inputType="textMultiLine"
+ android:text="# Local listeners add listener tcp local0 127.0.0.1 9695 add listener udp local1 127.0.0.1 9695 # Remote face add listener udp remote0 %%source_ip%% %%source_port%% add connection udp conn0 %%destination_ip%% %%destination_port%% %%source_ip%% %%source_port%% # Route add route conn0 ccnx:/webserver 1# Local listeners add listener tcp local0 127.0.0.1 9695 add listener udp local1 127.0.0.1 9695 # Remote face add listener udp remote0 %%source_ip%% %%source_port%% add connection udp conn0 %%destination_ip%% %%destination_port%% %%source_ip%% %%source_port%% # Route add route conn0 ccnx:/webserver 1# Local listeners add listener tcp local0 127.0.0.1 9695 add listener udp local1 127.0.0.1 9695 # Remote face add listener udp remote0 %%source_ip%% %%source_port%% add connection udp conn0 %%destination_ip%% %%destination_port%% %%source_ip%% %%source_port%% # Route add route conn0 ccnx:/webserver 1# Local listeners add listener tcp local0 127.0.0.1 9695 add listener udp local1 127.0.0.1 9695 # Remote face add listener udp remote0 %%source_ip%% %%source_port%% add connection udp conn0 %%destination_ip%% %%destination_port%% %%source_ip%% %%source_port%% # Route add route conn0 ccnx:/webserver 1# Local listeners add listener tcp local0 127.0.0.1 9695 add listener udp local1 127.0.0.1 9695 # Remote face add listener udp remote0 %%source_ip%% %%source_port%% add connection udp conn0 %%destination_ip%% %%destination_port%% %%source_ip%% %%source_port%% # Route add route conn0 ccnx:/webserver 1"
+ app:layout_constraintVertical_bias="0.33999997" />
+ </ScrollView>
+
+ </LinearLayout>
+
+ <Switch
+ android:id="@+id/metisForwarderSwitch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="Disabled"
+ android:textSize="30sp" />
+ </LinearLayout>
+</android.support.constraint.ConstraintLayout>
diff --git a/MetisForwarder/app/src/main/res/layout/spinner_layout.xml b/MetisForwarder/app/src/main/res/layout/spinner_layout.xml
new file mode 100644
index 00000000..c73af27b
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/layout/spinner_layout.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="24sp"
+ android:padding="5dp"
+ /> \ No newline at end of file
diff --git a/MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher.png b/MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..cde69bcc
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000..9a078e3e
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher.png b/MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..c133a0cb
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000..efc028a6
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..bfa42f0e
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..3af2608a
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..324e72cd
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..9bec2e62
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..aee44e13
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000..34947cd6
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/MetisForwarder/app/src/main/res/values/colors.xml b/MetisForwarder/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..3ab3e9cb
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#3F51B5</color>
+ <color name="colorPrimaryDark">#303F9F</color>
+ <color name="colorAccent">#FF4081</color>
+</resources>
diff --git a/MetisForwarder/app/src/main/res/values/strings.xml b/MetisForwarder/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..8be706b0
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="app_name">MetisForwarder</string>
+</resources>
diff --git a/MetisForwarder/app/src/main/res/values/styles.xml b/MetisForwarder/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..5885930d
--- /dev/null
+++ b/MetisForwarder/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+
+</resources>
diff --git a/MetisForwarder/app/src/test/java/com/metis/ccnx/metisforwarder/ExampleUnitTest.java b/MetisForwarder/app/src/test/java/com/metis/ccnx/metisforwarder/ExampleUnitTest.java
new file mode 100644
index 00000000..1b8f1316
--- /dev/null
+++ b/MetisForwarder/app/src/test/java/com/metis/ccnx/metisforwarder/ExampleUnitTest.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.metis.ccnx.metisforwarder;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}