diff options
Diffstat (limited to 'ccnxandroidmetis/ccnxsupportlibrary')
10 files changed, 0 insertions, 469 deletions
diff --git a/ccnxandroidmetis/ccnxsupportlibrary/build.gradle b/ccnxandroidmetis/ccnxsupportlibrary/build.gradle deleted file mode 100644 index 3ec07d19..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/build.gradle +++ /dev/null @@ -1,66 +0,0 @@ - -apply plugin: 'com.android.library' - -android { - compileSdkVersion 23 - buildToolsVersion '25.0.0' - - defaultConfig { - minSdkVersion 15 - targetSdkVersion 23 - versionCode 1 - versionName "1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - debug { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - sourceSets { - main { - jni.srcDirs = [] - java.srcDirs = ['src/main/java'] - resources.srcDirs = ['src/main/res'] - res.srcDirs = ['src/main/res'] - jniLibs.srcDirs = ['src/main/libs'] - assets.srcDirs = ['src/main/assets'] - } - } - - task buildNative(type: Exec, description: 'Compile JNI source via NDK') { - def ndkDir = android.ndkDirectory - commandLine "$ndkDir/ndk-build", - '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source - '-j', Runtime.runtime.availableProcessors(), - 'all', - 'NDK_DEBUG=1' - } - - task cleanNative(type: Exec, description: 'Clean JNI object files') { - def ndkDir = android.ndkDirectory - commandLine "$ndkDir/ndk-build", - '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source - 'clean' - } - - tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn(buildNative) - } - - clean.dependsOn 'cleanNative' -} - -dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - testCompile 'junit:junit:4.12' - compile 'com.android.support:appcompat-v7:23.4.0' -} - -configurations.maybeCreate("default") -artifacts.add("default", file('build/outputs/aar/ccnxsupportlibrary-release.aar')) diff --git a/ccnxandroidmetis/ccnxsupportlibrary/proguard-rules.pro b/ccnxandroidmetis/ccnxsupportlibrary/proguard-rules.pro deleted file mode 100644 index c51dd9b5..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/walendo/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 *; -#} diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/AndroidManifest.xml b/ccnxandroidmetis/ccnxsupportlibrary/src/main/AndroidManifest.xml deleted file mode 100644 index 8ac2d0c6..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/AndroidManifest.xml +++ /dev/null @@ -1,32 +0,0 @@ -<!-- - ~ 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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.metis.ccnx.ccnxsupportlibrary"> - - <application - android:allowBackup="true" - android:label="@string/app_name" - android:supportsRtl="true"> - - </application> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-permission - android:name="android.permission.READ_EXTERNAL_STORAGE" - android:maxSdkVersion="21" /> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - -</manifest> diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/java/com/metis/ccnx/ccnxsupportlibrary/Metis.java b/ccnxandroidmetis/ccnxsupportlibrary/src/main/java/com/metis/ccnx/ccnxsupportlibrary/Metis.java deleted file mode 100644 index 5be6af9a..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/java/com/metis/ccnx/ccnxsupportlibrary/Metis.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ccnxsupportlibrary; - -public class Metis { - - private static Metis sInstance = null; - - static { - System.loadLibrary("ccnxsupportlibrary"); - } - - public static Metis getInstance() { - if (sInstance == null) { - sInstance = new Metis(); - } - return sInstance; - } - - private Metis() { - - } - - public native boolean isRunning(); - public native void start(String path); - public native void stop(); -} diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/Android.mk b/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/Android.mk deleted file mode 100644 index 6613742d..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/Android.mk +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################## -# 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. -############################################################################## -LOCAL_PATH := $(call my-dir) - -subdirs := $(call all-subdir-makefiles) - -include $(subdirs) diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/Application.mk b/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/Application.mk deleted file mode 100644 index bd11e2d6..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/Application.mk +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# 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. -############################################################################## - -APP_PLATFORM := android-23 - -APP_ABI := armeabi-v7a - -APP_MODULES += ccnxsupportlibrary diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Android.mk b/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Android.mk deleted file mode 100644 index 2d2ab65c..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Android.mk +++ /dev/null @@ -1,121 +0,0 @@ -############################################################################## -# 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. -############################################################################## - -LOCAL_PATH := $(call my-dir) - -ARMDIST_ROOT := $(DISTILLERY_ROOT_DIR) - -ARMDIST := $(ARMDIST_ROOT)/usr -ARMDEPS := $(ARMDIST_ROOT)/usr -METIS_INC := $(ARMDIST_ROOT)/usr/include - -include $(CLEAR_VARS) -LOCAL_MODULE := liblongbow-ansiterm -LOCAL_SRC_FILES := $(ARMDIST)/lib/liblongbow-ansiterm.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := liblongbow-textplain -LOCAL_SRC_FILES := $(ARMDIST)/lib/liblongbow-textplain.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libparc -LOCAL_SRC_FILES := $(ARMDIST)/lib/libparc.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libmetis -LOCAL_SRC_FILES := $(ARMDIST)/lib/libmetis.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libccnx_api_control -LOCAL_SRC_FILES := $(ARMDIST)/lib/libccnx_api_control.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libccnx_api_notify -LOCAL_SRC_FILES := $(ARMDIST)/lib/libccnx_api_notify.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libccnx_api_portal -LOCAL_SRC_FILES := $(ARMDIST)/lib/libccnx_api_portal.a -include $(PREBUILT_STATIC_LIBRARY) -include $(CLEAR_VARS) - -include $(CLEAR_VARS) -LOCAL_MODULE := libccnx_transport_rta -LOCAL_SRC_FILES := $(ARMDIST)/lib/libccnx_transport_rta.a -include $(PREBUILT_STATIC_LIBRARY) -include $(CLEAR_VARS) - -include $(CLEAR_VARS) -LOCAL_MODULE := libccnx_common -LOCAL_SRC_FILES := $(ARMDIST)/lib/libccnx_common.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libevent -LOCAL_SRC_FILES := $(ARMDEPS)/lib/libevent.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libssl -LOCAL_SRC_FILES := $(ARMDEPS)/lib/libssl.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := libcrypto -LOCAL_SRC_FILES := $(ARMDEPS)/lib/libcrypto.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := liblongbow -LOCAL_SRC_FILES := $(ARMDIST)/lib/liblongbow.a -include $(PREBUILT_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE := ccnxsupportlibrary - - -LOCAL_SRC_FILES := \ - Metis_wrap.c - -LOCAL_CFLAGS := $(M_CFLAGS) $(OS_CFLAGS) -I$(ARMDIST)/include -I$(METIS_INC) - -LOCAL_CFLAGS += -I$(ARMDIST)/include -I$(METIS_INC) -LOCAL_CFLAGS += -std=c99 -g - - -LOCAL_LDLIBS := -ldl -llog $(OS_LDFLAGS) - -LOCAL_STATIC_LIBRARIES := \ - libmetis \ - libccnx_api_portal \ - libccnx_api_control \ - libccnx_api_notify \ - libccnx_transport_rta \ - libccnx_common \ - libparc \ - liblongbow \ - liblongbow-textplain \ - liblongbow-ansiterm \ - libssl \ - libevent \ - libcrypto - -include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Metis_wrap.c b/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Metis_wrap.c deleted file mode 100644 index c23d48aa..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Metis_wrap.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 <unistd.h> -#include <string.h> -#include <stdio.h> -#include <getopt.h> -#include <sys/param.h> -#include <sys/utsname.h> -#include <pthread.h> -#include <dirent.h> -#include <android/log.h> -#include "Metis_wrap.h" -#include <ccnx/forwarder/metis/core/metis_Forwarder.h> -#include <ccnx/forwarder/metis/core/metis_System.h> -#include <ccnx/forwarder/metis/content_store/metis_ContentStoreInterface.h> -#include <ccnx/api/control/cpi_Listener.h> -#include <ccnx/api/control/cpi_InterfaceSet.h> - - -static bool _isRunning = false; - - -static MetisForwarder *metis; - -static void -_setLogLevelToLevel(int logLevelArray[MetisLoggerFacility_END], MetisLoggerFacility facility, const char *levelString) -{ - PARCLogLevel level = parcLogLevel_FromString(levelString); - - if (level < PARCLogLevel_All) { - // we have a good facility and level - logLevelArray[facility] = level; - } else { - printf("Invalid log level string %s\n", levelString); - __android_log_print(ANDROID_LOG_DEBUG, "Metis Wrap", "Invalid log level stringa %s", levelString); - } -} - - -static void -_setLogLevel(int logLevelArray[MetisLoggerFacility_END], const char *string) -{ - char *tofree = parcMemory_StringDuplicate(string, strlen(string)); - char *p = tofree; - - char *facilityString = strsep(&p, "="); - if (facilityString) { - char *levelString = p; - - if (strcasecmp(facilityString, "all") == 0) { - for (MetisLoggerFacility facility = 0; facility < MetisLoggerFacility_END; facility++) { - _setLogLevelToLevel(logLevelArray, facility, levelString); - } - } else { - MetisLoggerFacility facility; - for (facility = 0; facility < MetisLoggerFacility_END; facility++) { - if (strcasecmp(facilityString, metisLogger_FacilityString(facility)) == 0) { - break; - } - } - - if (facility < MetisLoggerFacility_END) { - _setLogLevelToLevel(logLevelArray, facility, levelString); - } else { - __android_log_print(ANDROID_LOG_DEBUG, "Metis Wrap", "Invalid facility string %s", facilityString); - } - } - } - parcMemory_Deallocate((void **) &tofree); -} - - - -JNIEXPORT void JNICALL Java_com_metis_ccnx_ccnxsupportlibrary_Metis_start - (JNIEnv *env, jobject obj, jstring path) -{ - if (!_isRunning) { - metis = metisForwarder_Create(NULL); - MetisConfiguration *configuration = metisForwarder_GetConfiguration(metis); - metisConfiguration_SetObjectStoreSize(configuration, 0); - metisConfiguration_StartCLI(configuration, 2001); - if (path != NULL) { - 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_ccnxsupportlibrary_Metis_stop - (JNIEnv *env, jobject obj) -{ - if(_isRunning) { - __android_log_print(ANDROID_LOG_DEBUG, "Metis Wrap", "%s", "stopping metis..."); - metisForwarder_Destroy(&metis); - metisDispatcher_Stop(metisForwarder_GetDispatcher(metis)); - sleep(1); - metisForwarder_Destroy(&metis); - _isRunning = false; - } -} - - -JNIEXPORT jboolean JNICALL Java_com_metis_ccnx_ccnxsupportlibrary_Metis_isRunning - (JNIEnv *env, jobject obj) { - __android_log_print(ANDROID_LOG_DEBUG, "Metis Wrap", "%s %d", " metis is running", _isRunning); - return _isRunning; -} - - diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Metis_wrap.h b/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Metis_wrap.h deleted file mode 100644 index ad4bceb2..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/jni/ccnxsupportlibrary/Metis_wrap.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 <android/log.h> - -#define LOG_TAG "CCNxSDK" -#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) - - diff --git a/ccnxandroidmetis/ccnxsupportlibrary/src/main/res/values/strings.xml b/ccnxandroidmetis/ccnxsupportlibrary/src/main/res/values/strings.xml deleted file mode 100644 index 843d2b5b..00000000 --- a/ccnxandroidmetis/ccnxsupportlibrary/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<resources> - <string name="app_name">CCNxSupportLibrary</string> -</resources> |