From f576bb657068397d7b536acd4199572e24afc613 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Sat, 16 Jan 2021 14:20:24 +0100 Subject: [HICN-674] change android class in facemgr Signed-off-by: Angelo Mantellini Change-Id: I585b4e03e7e01513b553c685e9845943ff02508a --- ctrl/facemgr/src/api.c | 72 +++++++++++----------- .../interfaces/android_utility/android_utility.c | 4 +- .../priority_controller/priority_controller.h | 2 +- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c index aeca057e0..9e029c5b7 100644 --- a/ctrl/facemgr/src/api.c +++ b/ctrl/facemgr/src/api.c @@ -21,12 +21,12 @@ #ifdef __ANDROID__ /* - * Use AndroidUtility to determine interface types + * Use FacemgrUtility to determine interface types * * NOTE: this is currently disabled as SDK APIs do not allow to determine the * type of interfaces that are DOWN */ -//#define WITH_ANDROID_UTILITY +//#define WITH_FACEMGR_UTILITY /* * Use priority controller interface @@ -59,9 +59,9 @@ #include "interfaces/bonjour/bonjour.h" #endif /* __linux__ */ -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY #include "interfaces/android_utility/android_utility.h" -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #include "interfaces/priority_controller/priority_controller.h" @@ -102,9 +102,9 @@ extern interface_ops_t network_framework_ops; extern interface_ops_t netlink_ops; extern interface_ops_t bonjour_ops; #endif -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY extern interface_ops_t android_utility_ops; -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef WITH_PRIORITY_CONTROLLER extern interface_ops_t priority_controller_ops; #endif @@ -164,9 +164,9 @@ struct facemgr_s { interface_t * hl; -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY interface_t * au; /* android_utility */ -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef WITH_PRIORITY_CONTROLLER interface_t * pc; @@ -540,7 +540,7 @@ int facemgr_query_bonjour(facemgr_t * facemgr, netdevice_t * netdevice) } #endif /* __linux__ */ -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY int facemgr_query_android_utility(facemgr_t * facemgr, netdevice_t netdevice) { /* Send an event to the interface */ @@ -566,7 +566,7 @@ ERR_ND: ERR_MALLOC: return -1; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ /** @@ -642,7 +642,7 @@ facemgr_facelet_satisfy_rules(facemgr_t * facemgr, facelet_t * facelet) } netdevice_type_t netdevice_type = NETDEVICE_TYPE_UNDEFINED; -#ifndef WITH_ANDROID_UTILITY +#ifndef WITH_FACEMGR_UTILITY /* * In addition to netdevice, netdevice_type should be present to correctly * apply rules @@ -652,7 +652,7 @@ facemgr_facelet_satisfy_rules(facemgr_t * facemgr, facelet_t * facelet) ERROR("[facemgr_facelet_satisfy_rules] Error retrieving netdevice_type from facelet"); return -2; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ /* Default ignore list */ if ((netdevice_type == NETDEVICE_TYPE_LOOPBACK) || (netdevice_type == NETDEVICE_TYPE_UNDEFINED)) { @@ -707,7 +707,7 @@ facemgr_facelet_satisfy_rules(facemgr_t * facemgr, facelet_t * facelet) return 0; } -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY /** * \brief Complements facelet information through Android Utility interface * \return 0 if request was successful, -1 in case of error, and -2 if the @@ -743,7 +743,7 @@ facemgr_complement_facelet_au(facemgr_t * facemgr, facelet_t * facelet) facelet_set_au_done(facelet); return 0; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef __linux__ /** @@ -765,7 +765,7 @@ facemgr_complement_facelet_bj(facemgr_t * facemgr, facelet_t * facelet) } netdevice_type_t netdevice_type = NETDEVICE_TYPE_UNDEFINED; -#ifndef WITH_ANDROID_UTILITY +#ifndef WITH_FACEMGR_UTILITY /* * In addition to netdevice, netdevice_type should be present to correctly * apply rules @@ -775,7 +775,7 @@ facemgr_complement_facelet_bj(facemgr_t * facemgr, facelet_t * facelet) ERROR("[facemgr_complement_facelet_bj] Error retrieving netdevice_type from facelet"); return -2; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ bool discovery; if (facemgr_cfg_get_discovery(facemgr->cfg, &netdevice, netdevice_type, @@ -837,7 +837,7 @@ facemgr_complement_facelet_manual(facemgr_t * facemgr, facelet_t * facelet) } netdevice_type_t netdevice_type = NETDEVICE_TYPE_UNDEFINED; -#ifndef WITH_ANDROID_UTILITY +#ifndef WITH_FACEMGR_UTILITY /* * In addition to netdevice, netdevice_type should be present to correctly * apply rules @@ -847,7 +847,7 @@ facemgr_complement_facelet_manual(facemgr_t * facemgr, facelet_t * facelet) ERROR("[facemgr_complement_facelet_manual] Error retrieving netdevice_type from facelet"); return -2; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ int family = AF_UNSPEC; if (facelet_has_family(facelet)) { @@ -959,11 +959,11 @@ facemgr_complement_facelet(facemgr_t * facemgr, facelet_t * facelet) if (!facelet_has_key(facelet)) return -2; -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY rc = facemgr_complement_facelet_au(facemgr, facelet); if (rc != -2) return rc; -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #if 0 if (!facelet_has_netdevice_type(facelet)) { @@ -1010,7 +1010,7 @@ int facemgr_assign_face_type(facemgr_t * facemgr, facelet_t * facelet) } netdevice_type_t netdevice_type = NETDEVICE_TYPE_UNDEFINED; -#ifndef WITH_ANDROID_UTILITY +#ifndef WITH_FACEMGR_UTILITY /* * In addition to netdevice, netdevice_type should be present to correctly * apply rules @@ -1020,7 +1020,7 @@ int facemgr_assign_face_type(facemgr_t * facemgr, facelet_t * facelet) ERROR("[facemgr_assign_face_type] Error retrieving netdevice_type from facelet"); return -2; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ facemgr_face_type_t face_type = FACEMGR_FACE_TYPE_UNDEFINED; if (facemgr_cfg_get_face_type(facemgr->cfg, &netdevice, netdevice_type, &face_type) < 0) @@ -1155,9 +1155,9 @@ facemgr_process_facelet(facemgr_t * facemgr, facelet_t * facelet) facelet_unset_admin_state(facelet); facelet_unset_state(facelet); facelet_unset_bj_done(facelet); -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY facelet_unset_au_done(facelet); -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ facelet_set_status(facelet, FACELET_STATUS_DELETED); #if 0 @@ -1418,9 +1418,9 @@ facemgr_consider_static_facelet(facemgr_t * facemgr, facelet_t * facelet) facelet_unset_state(new_facelet); facelet_unset_bj_done(new_facelet); facelet_clear_routes(new_facelet); -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY facelet_unset_au_done(new_facelet); -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ /* We try to apply static_facelet over facelet */ if (!facelet_match(new_facelet, static_facelet)) { @@ -1652,9 +1652,9 @@ facemgr_process_facelet_delete(facemgr_t * facemgr, facelet_t * facelet) facelet_unset_admin_state(facelet); facelet_unset_state(facelet); facelet_unset_bj_done(facelet); -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY facelet_unset_au_done(facelet); -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ facelet_unset_error(facelet); facelet_set_status(facelet, FACELET_STATUS_DELETED); #if 0 @@ -2190,13 +2190,13 @@ facemgr_bootstrap(facemgr_t * facemgr) } #endif /* __linux__ */ -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY rc = interface_register(&android_utility_ops); if (rc < 0) { ERROR("[facemgr_bootstrap] Error registering android_utility interface"); goto ERR_REGISTER; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef WITH_PRIORITY_CONTROLLER INFO("[facemgr_bootstrap] registering priority_controller interface"); @@ -2247,7 +2247,7 @@ facemgr_bootstrap(facemgr_t * facemgr) } #endif /* __linux__ */ -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY android_utility_cfg_t au_cfg = { .jvm = facemgr->jvm, }; @@ -2256,7 +2256,7 @@ facemgr_bootstrap(facemgr_t * facemgr) ERROR("Error creating 'Android Utility' interface\n"); goto ERR_AU_CREATE; } -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef WITH_PRIORITY_CONTROLLER INFO("[facemgr_bootstrap] creating priority_controller interface"); @@ -2300,10 +2300,10 @@ ERR_UPDOWN_CREATE: facemgr_delete_interface(facemgr, facemgr->dummy); ERR_DUMMY_CREATE: #endif -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY facemgr_delete_interface(facemgr, facemgr->au); ERR_AU_CREATE: -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef WITH_PRIORITY_CONTROLLER facemgr_delete_interface(facemgr, facemgr->pc); ERR_PC_CREATE: @@ -2353,9 +2353,9 @@ void facemgr_stop(facemgr_t * facemgr) } #endif /* __linux__ */ -#ifdef WITH_ANDROID_UTILITY +#ifdef WITH_FACEMGR_UTILITY facemgr_delete_interface(facemgr, facemgr->au); -#endif /* WITH_ANDROID_UTILITY */ +#endif /* WITH_FACEMGR_UTILITY */ #ifdef WITH_PRIORITY_CONTROLLER facemgr_delete_interface(facemgr, facemgr->pc); diff --git a/ctrl/facemgr/src/interfaces/android_utility/android_utility.c b/ctrl/facemgr/src/interfaces/android_utility/android_utility.c index d1fe324fb..d8e20659a 100644 --- a/ctrl/facemgr/src/interfaces/android_utility/android_utility.c +++ b/ctrl/facemgr/src/interfaces/android_utility/android_utility.c @@ -28,7 +28,7 @@ #include "android_utility.h" -#define FACEMGR_ANDROID_UTILITY_CLASS "com/cisco/hicn/forwarder/supportlibrary/AndroidUtility" +#define FACEMGR_UTILITY_CLASS "com/cisco/hicn/facemgrlibrary/supportlibrary/FacemgrUtility" #define AU_INTERFACE_TYPE_UNDEFINED 0 @@ -89,7 +89,7 @@ int au_on_event(interface_t * interface, facelet_t * facelet) JNIEnv *env; JavaVM *jvm = data->cfg.jvm; (*jvm)->AttachCurrentThread(jvm, &env, NULL); - jclass cls = (*env)->FindClass(env, FACEMGR_ANDROID_UTILITY_CLASS); + jclass cls = (*env)->FindClass(env, FACEMGR_UTILITY_CLASS); jmethodID getNetworkType = (*env)->GetStaticMethodID(env, cls, "getNetworkType", "(Ljava/lang/String;)I"); jint interface_type = (*env)->CallStaticIntMethod(env, cls, getNetworkType, diff --git a/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.h b/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.h index 2ad8439c6..247fc3c57 100644 --- a/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.h +++ b/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.h @@ -21,7 +21,7 @@ #ifndef FACEMGR_INTERFACE_PRIORITY_CONTROLLER #define FACEMGR_INTERFACE_PRIORITY_CONTROLLER -#define FACEMGR_ANDROID_UTILITY_CLASS "com/cisco/hicn/forwarder/supportlibrary/AndroidUtility" +#define FACEMGR_UTILITY_CLASS "com/cisco/hicn/facemgrlibrary/supportlibrary/FacemgrUtility" /* * Uncomment this line to use a Priority controller interface internal to the -- cgit 1.2.3-korg