Makefile added / pkg-config descriptor
[metux-java.git] / ip / IPSEC_SA.java
blobd73d6eaf71236d10baf4e30782e2d537574518aa
2 package org.de.metux.ip;
4 import org.de.metux.util.Exec;
5 import java.net.UnknownHostException;
7 public class IPSEC_SA
9 String spi;
11 public IPSEC_SA(String spi_val)
13 spi = spi_val;
16 public boolean delete()
18 return Exec.exec_command("ipsecadm sa del --spi="+spi);
21 public boolean add(
22 String source,
23 String destination,
24 String cipher,
25 String cipher_keyfile,
26 String digest,
27 String digest_keyfile,
28 boolean duplex
30 throws UnknownHostException
32 String cmdline =
33 "ipsecadm sa add "+
34 " --spi="+spi+
35 " --src="+Lookup.getIP_str(source)+
36 " --dst="+Lookup.getIP_str(destination)+
37 " --cipher="+cipher+
38 " --cipher-keyfile="+cipher_keyfile+
39 " --digest="+digest+
40 " --digest-keyfile="+digest_keyfile+
41 (duplex ? " --duplex" : "");
43 return Exec.exec_command(cmdline);