summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVPN.java
diff options
context:
space:
mode:
authorschwabe <devnull@localhost>2012-04-28 19:58:02 +0200
committerschwabe <devnull@localhost>2012-04-28 19:58:02 +0200
commit63e466054c2f1d66e4618ac4d73208751f1e5bd1 (patch)
tree84a00021ec486093b406ec050087ee486f6e6958 /src/de/blinkt/openvpn/OpenVPN.java
parent031186e74c9f174d05a09c4059def7bcbc558ac6 (diff)
Almost ready for version 0.4
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVPN.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVPN.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java
index b49bdf68..bca276c9 100644
--- a/src/de/blinkt/openvpn/OpenVPN.java
+++ b/src/de/blinkt/openvpn/OpenVPN.java
@@ -1,6 +1,7 @@
package de.blinkt.openvpn;
import java.util.LinkedList;
+import java.util.Vector;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -17,6 +18,11 @@ public class OpenVPN {
public static LinkedList<String> logbuffer = new LinkedList<String>();
private static int counter=0;
+ private static Vector<LogListener> logListener=new Vector<OpenVPN.LogListener>();
+
+ public interface LogListener {
+ void newLog(String logmessage);
+ }
static {
System.loadLibrary("crypto");
@@ -40,6 +46,19 @@ public class OpenVPN {
// Force GC how and then to kill loose ends
if(counter++ % 50==0)
System.gc();
+
+ for (LogListener ll : logListener) {
+ ll.newLog(prefix + " " + message);
+ }
+
+ }
+
+ synchronized static void addLogListener(LogListener ll){
+ logListener.add(ll);
+ }
+
+ synchronized static void removeLogListener(LogListener ll) {
+ logListener.remove(ll);
}
@@ -48,6 +67,18 @@ public class OpenVPN {
Log.i("openvpn","Got interface info M" + mtu + " L: " + local + "R: " + remote);
localip=local;
}
+
+ static void addDns(String dns) {
+ Log.i("openvpn","Got DNS Server: " + dns);
+ mOpenVpnService.addDNS(dns);
+ }
+
+
+ static void addDomain(String domain) {
+ Log.i("openvpn","Got DNS Domain: " + domain);
+ mOpenVpnService.setDomain(domain);
+ }
+
public static void setCallback(OpenVpnService openVpnService) {
mOpenVpnService = openVpnService;