android: Build libpts and init/deinit libpts in BYOD IMC
authorTobias Brunner <tobias@strongswan.org>
Wed, 24 Apr 2013 16:36:59 +0000 (18:36 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 16:49:26 +0000 (18:49 +0200)
src/frontends/android/jni/Android.mk
src/frontends/android/jni/libandroidbridge/Android.mk
src/frontends/android/jni/libandroidbridge/byod/imc_android.c
src/frontends/android/src/org/strongswan/android/logic/CharonVpnService.java

index 781d8a1..0163e30 100644 (file)
@@ -77,7 +77,8 @@ ifneq ($(strongswan_USE_BYOD),)
 strongswan_BUILD += \
        strongswan/src/libtnccs \
        strongswan/src/libtncif \
-       strongswan/src/libimcv
+       strongswan/src/libimcv \
+       strongswan/src/libpts
 endif
 
 include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
index ca15472..29f95e5 100644 (file)
@@ -34,6 +34,7 @@ LOCAL_C_INCLUDES += \
        $(strongswan_PATH)/src/libimcv \
        $(strongswan_PATH)/src/libtncif \
        $(strongswan_PATH)/src/libtnccs \
+       $(strongswan_PATH)/src/libpts \
        $(strongswan_PATH)/src/libtls
 endif
 
@@ -53,7 +54,7 @@ LOCAL_LDLIBS := -llog
 LOCAL_SHARED_LIBRARIES := libstrongswan libhydra libipsec libcharon
 
 ifneq ($(strongswan_USE_BYOD),)
-LOCAL_SHARED_LIBRARIES += libimcv libtncif libtnccs
+LOCAL_SHARED_LIBRARIES += libimcv libtncif libtnccs libpts
 endif
 
 include $(BUILD_SHARED_LIBRARY)
index f83b6fd..06edf35 100644 (file)
@@ -17,6 +17,7 @@
 #include "imc_android_state.h"
 
 #include <tnc/tnc.h>
+#include <libpts.h>
 #include <imc/imc_agent.h>
 #include <imc/imc_msg.h>
 #include <pa_tnc/pa_tnc_msg.h>
@@ -64,6 +65,8 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
                return TNC_RESULT_FATAL;
        }
 
+       libpts_init();
+
        if (min_version > TNC_IFIMC_VERSION_1 || max_version < TNC_IFIMC_VERSION_1)
        {
                DBG1(DBG_IMC, "no common IF-IMC version");
@@ -352,6 +355,8 @@ TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
                DBG1(DBG_IMC, "IMC \"%s\" has not been initialized", imc_name);
                return TNC_RESULT_NOT_INITIALIZED;
        }
+       /* has to be done before destroying the agent / deinitializing libimcv */
+       libpts_deinit();
        imc_android->destroy(imc_android);
        imc_android = NULL;
        return TNC_RESULT_SUCCESS;
index 5670131..f08a481 100644 (file)
@@ -606,6 +606,7 @@ public class CharonVpnService extends VpnService implements Runnable
                        System.loadLibrary("tncif");
                        System.loadLibrary("tnccs");
                        System.loadLibrary("imcv");
+                       System.loadLibrary("pts");
                }
 
                System.loadLibrary("hydra");