aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge@cisco.com>2019-10-30 17:56:08 +0100
committerJordan Augé <jordan.auge@cisco.com>2019-10-31 13:41:47 +0100
commit95170bf3a69597b49238bb7ff396d41f6dc94f30 (patch)
tree2f9b565e84514d7ee25cfd874235dd25e9300a0f /ctrl/facemgr/src/interfaces/android_utility/android_utility.c
parentfc6dfe9f7ee02834ae1e6f56e0aaee36ac3e88dd (diff)
[HICN-369] Implement reconciliation state machine in face manager incl. reattempts in case of errors
Change-Id: Ia4ecf621fbd513d9e29313d2aaa487aa65811183 Signed-off-by: Jordan Augé <jordan.auge@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/interfaces/android_utility/android_utility.c')
-rw-r--r--ctrl/facemgr/src/interfaces/android_utility/android_utility.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ctrl/facemgr/src/interfaces/android_utility/android_utility.c b/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
index a4aa2cbfc..e7c73df8b 100644
--- a/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
+++ b/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
@@ -24,17 +24,18 @@
#include <hicn/ctrl/face.h>
#include <hicn/util/log.h>
#include "../../common.h"
-#include "../../facelet.h"
#include "../../interface.h"
#include <hicn/android_utility/android_utility.h>
#define FACEMGR_ANDROID_UTILITY_CLASS "com/cisco/hicn/forwarder/supportlibrary/AndroidUtility"
+
#define AU_INTERFACE_TYPE_UNDEFINED 0
#define AU_INTERFACE_TYPE_WIRED 1
#define AU_INTERFACE_TYPE_WIFI 2
#define AU_INTERFACE_TYPE_CELLULAR 3
-#define AU_INTERFACE_TYPE_LOOPBACK 4 /* not supported yet */
+#define AU_INTERFACE_TYPE_LOOPBACK 4
+#define AU_INTERFACE_TYPE_UNAVAILABLE 5
#define ERR_STR_JAVA "Java VM parameters are required in the interface configuration."
@@ -77,14 +78,12 @@ int au_on_event(interface_t * interface, const facelet_t * facelet)
* correct interface type, based on the value returned by the Android
* utility shipped with the Android forwarder.
*/
- DEBUG("Android utility received request");
au_data_t * data = (au_data_t*)interface->data;
netdevice_t netdevice = NETDEVICE_EMPTY;
int rc = facelet_get_netdevice(facelet, &netdevice);
if (rc < 0)
return -1;
- DEBUG("[au_on_event] netdevice=%s", netdevice.name);
JNIEnv *env;
JavaVM *jvm = data->cfg.jvm;
@@ -95,8 +94,6 @@ int au_on_event(interface_t * interface, const facelet_t * facelet)
jint interface_type = (*env)->CallStaticIntMethod(env, cls, getNetworkType,
(*env)->NewStringUTF(env, netdevice.name));
- DEBUG("Processing results for interface %s", netdevice.name);
-
netdevice_type_t netdevice_type = AU_INTERFACE_TYPE_UNDEFINED;
switch(interface_type) {
case AU_INTERFACE_TYPE_UNDEFINED:
@@ -114,15 +111,17 @@ int au_on_event(interface_t * interface, const facelet_t * facelet)
netdevice_type = NETDEVICE_TYPE_LOOPBACK;
break;
default:
+ DEBUG("AU RETURNED ERROR");
return -1;
}
+ DEBUG("AU RETURNED %s : %s", netdevice.name, netdevice_type_str[netdevice_type]);
+
facelet_t * facelet_new = facelet_create();
facelet_set_netdevice(facelet_new, netdevice);
facelet_set_status(facelet_new, FACELET_STATUS_CLEAN);
facelet_set_netdevice_type(facelet_new, netdevice_type);
- DEBUG("sending AU udpate");
facelet_set_event(facelet_new, FACELET_EVENT_UPDATE);
interface_raise_event(interface, facelet_new);