Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | import java.net.InetAddress; |
| 2 | import org.openvpp.vppjapi.*; |
| 3 | |
| 4 | public class vppApi extends vppConn { |
| 5 | |
| 6 | native int controlPing(); |
| 7 | native void test (byte[] array, byte[] array2); |
| 8 | |
| 9 | public static void main (String[] args) throws Exception { |
| 10 | vppApi api = new vppApi (); |
| 11 | String ipv6 = "db01::feed"; |
| 12 | String ipv4 = "192.168.1.1"; |
| 13 | InetAddress addr6 = InetAddress.getByName(ipv6); |
| 14 | InetAddress addr4 = InetAddress.getByName(ipv4); |
| 15 | byte[] ip4bytes = addr4.getAddress(); |
| 16 | byte[] ip6bytes = addr6.getAddress(); |
| 17 | int rv; |
| 18 | |
| 19 | api.test(ip4bytes,ip6bytes); |
| 20 | |
| 21 | rv = api.clientConnect ("JavaTest"); |
| 22 | if (rv == 0) |
| 23 | System.out.printf ("Connected OK..."); |
| 24 | else |
| 25 | { |
| 26 | System.out.printf ("clientConnect returned %d\n", rv); |
| 27 | System.exit (1); |
| 28 | } |
| 29 | rv = api.controlPing(); |
| 30 | System.out.printf ("data plane pid is %d\n", rv); |
| 31 | |
| 32 | Thread.sleep (5000); |
| 33 | |
| 34 | api.clientDisconnect(); |
| 35 | System.out.printf ("Done...\n"); |
| 36 | } |
| 37 | } |