Function added that allows to update VPN state via JNI
[strongswan.git] / src / frontends / android / jni / libandroidbridge / charonservice.h
index 8bacd0a..c537165 100644 (file)
 
 #include <library.h>
 
+typedef enum android_vpn_state_t android_vpn_state_t;
 typedef struct charonservice_t charonservice_t;
 
 /**
+ * VPN status codes. As defined in CharonVpnService.java
+ */
+enum android_vpn_state_t {
+       CHARONSERVICE_CHILD_STATE_UP = 1,
+       CHARONSERVICE_CHILD_STATE_DOWN,
+       CHARONSERVICE_AUTH_ERROR,
+       CHARONSERVICE_PEER_AUTH_ERROR,
+       CHARONSERVICE_LOOKUP_ERROR,
+       CHARONSERVICE_UNREACHABLE_ERROR,
+       CHARONSERVICE_GENERIC_ERROR,
+};
+
+/**
  * Public interface of charonservice.
  *
  * Used to communicate with CharonVpnService via JNI
@@ -40,6 +54,14 @@ typedef struct charonservice_t charonservice_t;
 struct charonservice_t {
 
        /**
+        * Update the status in the Java domain (UI)
+        *
+        * @param code                  status code
+        * @return                              TRUE on success
+        */
+       bool (*update_status)(charonservice_t *this, android_vpn_state_t code);
+
+       /**
         * Install a bypass policy for the given socket using the protect() Method
         * of the Android VpnService interface
         *