diff --git a/.gitignore b/.gitignore index 72569c982..22dc4582a 100755 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ /netconf/netconf.db java/obj/ java/libs/ +java/bin/ diff --git a/java/build.xml b/java/build.xml new file mode 100644 index 000000000..0c73030c6 --- /dev/null +++ b/java/build.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/src/com/zerotierone/sdk/Node.java b/java/src/com/zerotierone/sdk/Node.java index 8225e0f09..bb8bbeeee 100644 --- a/java/src/com/zerotierone/sdk/Node.java +++ b/java/src/com/zerotierone/sdk/Node.java @@ -44,7 +44,7 @@ public class Node { * * -1 if the node has already been closed */ - private final long nodeId; + private long nodeId; private final DataStoreGetListener getListener; private final DataStorePutListener putListener; @@ -68,7 +68,7 @@ public class Node { this.configListener = configListener; ResultCode rc = node_init(now); - if(rc.getValue() != ResultCode.RESULT_OK) + if(rc != ResultCode.RESULT_OK) { // TODO: Throw Exception } @@ -97,7 +97,7 @@ public class Node { long[] nextBackgroundTaskDeadline) { return processVirtualNetworkFrame( nodeId, now, nwid, sourceMac, destMac, etherType, vlanId, - frameData, frameLength, nextBackgroundTaskDeadline); + frameData, nextBackgroundTaskDeadline); } public ResultCode processWirePacket( @@ -111,7 +111,7 @@ public class Node { nextBackgroundTaskDeadline); } - public ResultCode processBackgroundTasks(long now, long nextBackgroundTaskDeadline) { + public ResultCode processBackgroundTasks(long now, long[] nextBackgroundTaskDeadline) { return processBackgroundTasks(nodeId, now, nextBackgroundTaskDeadline); } @@ -159,14 +159,14 @@ public class Node { // TODO: ZT1_Node_peers - public VirtualNetworkConfig networkConfig() { - return networkConfig(nodeId); + public VirtualNetworkConfig networkConfig(long nwid) { + return networkConfig(nodeId, nwid); } // TODO: ZT1_Node_networks - public Version version() { - return version(nodeId); + public Version getVersion() { + return version(); } /** diff --git a/java/src/com/zerotierone/sdk/VirtualNetworkConfig.java b/java/src/com/zerotierone/sdk/VirtualNetworkConfig.java index db52b4cd1..8085994b9 100644 --- a/java/src/com/zerotierone/sdk/VirtualNetworkConfig.java +++ b/java/src/com/zerotierone/sdk/VirtualNetworkConfig.java @@ -29,7 +29,7 @@ package com.zerotierone.sdk; import java.lang.String; import java.util.ArrayList; -import java.net.InetAddresss; +import java.net.InetAddress; public class VirtualNetworkConfig { public static final int MAX_MULTICAST_SUBSCRIPTIONS = 4096; @@ -41,13 +41,72 @@ public class VirtualNetworkConfig { private VirtualNetworkStatus status; private VirtualNetworkType type; private int mtu; - private int dhcp; - private int bridge; - private int broadcastEnabled; - private int portError; + private boolean dhcp; + private boolean bridge; + private boolean broadcastEnabled; + private boolean portError; private boolean enabled; private long netconfRevision; private int multicastSubscriptionCount; private ArrayList multicastSubscriptions; private ArrayList assignedAddresses; -} \ No newline at end of file + + private VirtualNetworkConfig() { + + } + + public final long networkId() { + return nwid; + } + public final long macAddress() { + return mac; + } + + public final String name() { + return name; + } + + public final VirtualNetworkStatus networkStatus() { + return status; + } + + public final VirtualNetworkType networkType() { + return type; + } + + public final int mtu() { + return mtu; + } + + public final boolean isDhcpAvailable() { + return dhcp; + } + + public final boolean isBridgeEnabled() { + return bridge; + } + + public final boolean broadcastEnabled() { + return broadcastEnabled; + } + + public final boolean portError() { + return portError; + } + + public final boolean isEnabled() { + return enabled; + } + + public final long netconfRevision() { + return netconfRevision; + } + + public final ArrayList multicastSubscriptions() { + return multicastSubscriptions; + } + + public final ArrayList assignedAddresses() { + return assignedAddresses; + } +}