diff options
author | cyBerta <cyberta@riseup.net> | 2017-09-21 00:57:47 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-09-21 00:57:47 +0200 |
commit | e5b3484d2723f7c9ecc8eb84c6574888799844e1 (patch) | |
tree | 01f310e2f48087a924c6fb7ccf148c2ad7c6ed08 | |
parent | 0805826ea742ff1db853e3a66dde71608c3de3b7 (diff) |
update ics-openvpn: add new aidl interface definitions
9 files changed, 175 insertions, 0 deletions
diff --git a/app/src/main/aidl/de/blinkt/openvpn/api/APIVpnProfile.aidl b/app/src/main/aidl/de/blinkt/openvpn/api/APIVpnProfile.aidl new file mode 100644 index 00000000..f6799659 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/api/APIVpnProfile.aidl @@ -0,0 +1,3 @@ +package de.blinkt.openvpn.api; + +parcelable APIVpnProfile; diff --git a/app/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl b/app/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl new file mode 100644 index 00000000..75d0c329 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl @@ -0,0 +1,66 @@ +// IOpenVPNAPIService.aidl +package de.blinkt.openvpn.api; + +import de.blinkt.openvpn.api.APIVpnProfile; +import de.blinkt.openvpn.api.IOpenVPNStatusCallback; + +import android.content.Intent; +import android.os.ParcelFileDescriptor; + +interface IOpenVPNAPIService { + List<APIVpnProfile> getProfiles(); + + void startProfile (String profileUUID); + + /** Use a profile with all certificates etc. embedded, + * old version which does not return the UUID of the addded profile, see + * below for a version that return the UUID on add */ + boolean addVPNProfile (String name, String config); + + /** start a profile using a config as inline string. Make sure that all needed data is inlined, + * e.g., using <ca>...</ca> or <auth-user-data>...</auth-user-data> + * See the OpenVPN manual page for more on inlining files */ + void startVPN (in String inlineconfig); + + /** This permission framework is used to avoid confused deputy style attack to the VPN + * calling this will give null if the app is allowed to use the external API and an Intent + * that can be launched to request permissions otherwise */ + Intent prepare (in String packagename); + + /** Used to trigger to the Android VPN permission dialog (VPNService.prepare()) in advance, + * if this return null OpenVPN for ANdroid already has the permissions otherwise you can start the returned Intent + * to let OpenVPN for Android request the permission */ + Intent prepareVPNService (); + + /* Disconnect the VPN */ + void disconnect(); + + /* Pause the VPN (same as using the pause feature in the notifcation bar) */ + void pause(); + + /* Resume the VPN (same as using the pause feature in the notifcation bar) */ + void resume(); + + /** + * Registers to receive OpenVPN Status Updates + */ + void registerStatusCallback(in IOpenVPNStatusCallback cb); + + /** + * Remove a previously registered callback interface. + */ + void unregisterStatusCallback(in IOpenVPNStatusCallback cb); + + /** Remove a profile by UUID */ + void removeProfile (in String profileUUID); + + /** Request a socket to be protected as a VPN socket would be. Useful for creating + * a helper socket for an app controlling OpenVPN + * Before calling this function you should make sure OpenVPN for Android may actually + * this function by checking if prepareVPNService returns null; */ + boolean protectSocket(in ParcelFileDescriptor fd); + + + /** Use a profile with all certificates etc. embedded */ + APIVpnProfile addNewVPNProfile (String name, boolean userEditable, String config); +}
\ No newline at end of file diff --git a/app/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl b/app/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl new file mode 100644 index 00000000..a94b3b44 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNStatusCallback.aidl @@ -0,0 +1,13 @@ +package de.blinkt.openvpn.api; + +/** + * Example of a callback interface used by IRemoteService to send + * synchronous notifications back to its clients. Note that this is a + * one-way interface so the server does not block waiting for the client. + */ +interface IOpenVPNStatusCallback { + /** + * Called when the service has a new status for you. + */ + oneway void newStatus(in String uuid, in String state, in String message, in String level); +} diff --git a/app/src/main/aidl/de/blinkt/openvpn/core/ConnectionStatus.aidl b/app/src/main/aidl/de/blinkt/openvpn/core/ConnectionStatus.aidl new file mode 100644 index 00000000..f37c3101 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/core/ConnectionStatus.aidl @@ -0,0 +1,3 @@ +package de.blinkt.openvpn.core; + +parcelable ConnectionStatus;
\ No newline at end of file diff --git a/app/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl b/app/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl new file mode 100644 index 00000000..3958bcf3 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/core/IOpenVPNServiceInternal.aidl @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2012-2016 Arne Schwabe + * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt + */ + +package de.blinkt.openvpn.core; + +/** + * Created by arne on 15.11.16. + */ + +interface IOpenVPNServiceInternal { + + boolean protect(int fd); + + void userPause(boolean b); + + /** + * @param replaceConnection True if the VPN is connected by a new connection. + * @return true if there was a process that has been send a stop signal + */ + boolean stopVPN(boolean replaceConnection); +} diff --git a/app/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl b/app/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl new file mode 100644 index 00000000..5a5cbdb5 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/core/IServiceStatus.aidl @@ -0,0 +1,36 @@ +// StatusIPC.aidl +package de.blinkt.openvpn.core; + +// Declare any non-default types here with import statements +import de.blinkt.openvpn.core.IStatusCallbacks; +import android.os.ParcelFileDescriptor; +import de.blinkt.openvpn.core.TrafficHistory; + + +interface IServiceStatus { + /** + * Registers to receive OpenVPN Status Updates and gets a + * ParcelFileDescript back that contains the log up to that point + */ + ParcelFileDescriptor registerStatusCallback(in IStatusCallbacks cb); + + /** + * Remove a previously registered callback interface. + */ + void unregisterStatusCallback(in IStatusCallbacks cb); + + /** + * Returns the last connedcted VPN + */ + String getLastConnectedVPN(); + + /** + * Sets a cached password + */ + void setCachedPassword(in String uuid, int type, String password); + + /** + * Gets the traffic history + */ + TrafficHistory getTrafficHistory(); +} diff --git a/app/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl b/app/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl new file mode 100644 index 00000000..75860b81 --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/core/IStatusCallbacks.aidl @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2012-2016 Arne Schwabe + * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt + */ + +package de.blinkt.openvpn.core; + +import de.blinkt.openvpn.core.LogItem; +import de.blinkt.openvpn.core.ConnectionStatus; + + + +interface IStatusCallbacks { + /** + * Called when the service has a new status for you. + */ + oneway void newLogItem(in LogItem item); + + oneway void updateStateString(in String state, in String msg, in int resid, in ConnectionStatus level); + + oneway void updateByteCount(long inBytes, long outBytes); + + oneway void connectedVPN(String uuid); +} diff --git a/app/src/main/aidl/de/blinkt/openvpn/core/LogItem.aidl b/app/src/main/aidl/de/blinkt/openvpn/core/LogItem.aidl new file mode 100644 index 00000000..9a7291af --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/core/LogItem.aidl @@ -0,0 +1,3 @@ +package de.blinkt.openvpn.core; + +parcelable LogItem;
\ No newline at end of file diff --git a/app/src/main/aidl/de/blinkt/openvpn/core/TrafficHistory.aidl b/app/src/main/aidl/de/blinkt/openvpn/core/TrafficHistory.aidl new file mode 100644 index 00000000..5bd255fc --- /dev/null +++ b/app/src/main/aidl/de/blinkt/openvpn/core/TrafficHistory.aidl @@ -0,0 +1,4 @@ +package de.blinkt.openvpn.core; + + +parcelable TrafficHistory; |