CharonVpnService provides a function to get trusted certificates via JNI
[strongswan.git] / src / frontends / android / jni / libandroidbridge / charonservice.h
index a356249..d0c0b71 100644 (file)
 #ifndef CHARONSERVICE_H_
 #define CHARONSERVICE_H_
 
+#include <library.h>
+#include <utils/linked_list.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
  */
 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
+        *
+        * @param fd                    socket file descriptor
+        * @param family                socket protocol family
+        * @return                              TRUE if operation successful
+        */
+       bool (*bypass_socket)(charonservice_t *this, int fd, int family);
+
+       /**
+        * Get a list of trusted certificates via JNI
+        *
+        * @return                              list of DER encoded certificates (as chunk_t*),
+        *                                              NULL on failure
+        */
+       linked_list_t *(*get_trusted_certificates)(charonservice_t *this);
+
 };
 
 /**