datasource/Cached_Content_Loader: added caching content loader
[metux-java.git] / ip / IPSEC_Device.java
blob4938a4cb6a01af9932356f0c5a7ece44376f86c6
2 package org.de.metux.ip;
4 import org.de.metux.util.Exec;
5 import java.net.UnknownHostException;
7 public class IPSEC_Device
9 String if_name;
11 public IPSEC_Device(String name)
13 if_name = name;
16 public boolean Tunnel_delete()
18 return Exec.exec_command("ifconfig "+if_name+" down") &&
19 Exec.exec_command("ipsecadm tunnel del "+if_name);
22 public boolean Tunnel_add(
23 String local_addr,
24 String remote_addr,
25 String spi)
26 throws UnknownHostException
28 return Exec.exec_command("ipsecadm tunnel add "+if_name+
29 " --local="+Lookup.getIP_str(local_addr)+
30 " --remote="+Lookup.getIP_str(remote_addr)+
31 " --spi="+spi
35 public boolean ConfigureIP(
36 String address,
37 String netmask,
38 int mtu
40 throws UnknownHostException
42 return Exec.exec_command(
43 "ifconfig "+if_name+
44 " inet "+Lookup.getIP_str(address)+
45 " netmask "+netmask+
46 " mtu "+mtu);